export default {
  initLabgroup(myself, intData) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "initlabgroup",
              }
          })
          .then(response => {
              if (response.flag == 1) {
                  if (response.glist.length > 0) {
                      myself.glist = response.glist;
                      let groupid = response.defid;
                      response.glist.forEach(element => {
                          if (element.labgroupid == response.defaultgroupid) {
                              groupid = response.defaultgroupid;
                          }
                      });
                      myself.searchParam.labgroupid = groupid;
                  } else {
                      myself.glist = [];
                  }
                  myself[intData]();
              } else {
                  // 没有权限，关闭页面
                  myself.$alert(response.msg, "错误", {
                      confirmButtonText: "确定"
                  }).then(() => {
                      //关闭当前页面
                      myself.$bus.$emit("close_current_tags");
                  });
              }
          })
          .catch(e => {});
  },
  previewProcess(myself, sampleid) {
      myself.$tool
          .request({
              url: "ucent/print",
              method: "post",
              data: {
                  action: "germsheetprintview",
                  sampleid: sampleid,
                  styleid: myself.samplestyleid,
              }
          })
          .then(res => {
              if (res.flag == "0") {
                  myself.$alert(res.msg);
              } else {
                  // this.processstr = '<embed id="embed-report" width="100%" height="' + document.getElementById("process").clientHeight + 'px"  name="plugin" src="' + res.pdfurl + '#toolbar=0" type="application/pdf" >';
                  var hml = '<embed id="embed-report" width="100%" height="' + (document.body.clientHeight - 140) + 'px"  name="plugin" src="' + res.pdfurl + '" type="application/pdf" >';
                  myself.$alert(hml, "流程单预览", {
                      dangerouslyUseHTMLString: true,
                      customClass: "rptprintview"
                  });
              }
          })
          .catch(e => {
              myself.$alert("预览报告出错！", "错误", {
                  confirmButtonText: "确定"
              });
          });
  },
  exePrtProcess(myself, printsampleid, userno,index) { // 打印流程单
      // console.log("printDta", printsampleid);
      if (typeof jsObj != "undefined") {
      //     const loading = this.$loading({
      //         lock: true,
      //         text: "打印中",
      //         spinner: "el-icon-loading",
      //         background: "rgba(0, 0, 0, 0.7)",
      //     });
      //     let userno = this.$tool.getSession(this.$tool.loginuserno);
      //     printData.foreach(element => {
    myself.$tool
      .request({
        url: "ucent/bactcomm",
        method: "post",
        data: {
          action: "saveprocessprint_flag",
          sampleid: printsampleid,
                      index:index,
        },
      }).then((res) => {
        if (res.flag == 1) {
          jsObj.PrintWebReport(printsampleid, userno, "LIS.02", myself.samplestyleid, "1");
        }
      }).catch((e) => {});
      //     });
      //     loading.close();
      } else {
          myself.$alert("请使用" + myself.$pub.clientname + "打开系统", "错误", {
              confirmButtonText: "确定"
          });
      }
  },
  getBactCount(myself) {
      myself.$tool
          .request({
              url: "ucent/ddl",
              method: "post",
              data: {
                  action: "seccode",
                  kindno: "GERMCOUNTS",
              },
          })
          .then((res) => {
              let bactcountList = res.Data;
              bactcountList.forEach((element, idx) => {
                  myself.bactcountList.push({ value: element.hidname });
              });
          })
          .catch((e) => {
              //console.log("erro", e);
          });
  },
  //菌落特征
  getBactFeature(myself) {
      myself.$tool
          .request({
              url: "ucent/ddl",
              method: "post",
              data: {
                  action: "seccode",
                  kindno: "COLONYFEATURE",
              },
          })
          .then((res) => {
              let bactfeatureList = res.Data;
              bactfeatureList.forEach((element, idx) => {
                  myself.bactfeatureList.push({ value: element.hidname });
              });
          })
          .catch((e) => {
              //console.log("erro", e);
          });
  },
  queryInputmdlitem(myself, rptunitid, tablename, inputmdlid, prgno) { // 涂片结果获取批输入模板内容
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "queryinputmdlitem",
                  rptunitid: rptunitid,
                  inputmdlid: inputmdlid,
              },
          })
          .then((response) => {
              if (response.data.length > 0) {
                  response.data.forEach((element) => {
                      var haveflag = false;
                      // this.sampleInfoList.forEach((item) => {
                      let tableData = myself.$refs[tablename].getTableData().fullData;
                      tableData.forEach((item) => {
                          if (element.rpt_itemcode == item.rpt_itemcode) {
                              haveflag = true;
                          }
                      });
                      if (!haveflag) {
                          // this.sampleInfoList = this.sampleInfoList.concat(element);
                          myself.$refs[tablename].insertAt(element, -1);
                          if (prgno == "BAC230") myself.changeFlag();
                      }
                  });
              }
              // this.sampleInfoList = this.sampleInfoList.concat(response.data);
          })
          .catch((e) => {});
  },
  resultActive(myself, row, column) {
      myself.textvalueshow = false;
      if (column.property == "result_str") {
          myself.iconclass = "el-icon-arrow-down";
          myself.textvalueshow = false;
          myself.getRptitemval(row.rpt_itemcode, 0);
      }
      if (column.property == "result1") {
          myself.getRptitemval(row.rpt_itemcode, 1);
      }
      if (column.property == "result2") {
          myself.getRptitemval(row.rpt_itemcode, 2);
      }
      if (column.property == "result3") {
          myself.getRptitemval(row.rpt_itemcode, 3);
      }
      if (column.property == "result4") {
          myself.getRptitemval(row.rpt_itemcode, 4);
      }
      if (column.property == "result5") {
          myself.getRptitemval(row.rpt_itemcode, 5);
      }
      if (column.property == "result6") {
          myself.getRptitemval(row.rpt_itemcode, 6);
      }
      if (column.property == "result_txt") {
          myself.getRptitemval(row.rpt_itemcode, 0);
      }
  },
  resultClass(myself, row) {
      // var stylestr = "padding:0 3px;";
      var stylestr = "";
      if (myself.Options.resultcolor_mode == "1") stylestr += "color:";
      else stylestr += "backgroundColor:";
      // console.log(row.result_flag, myself.Options)
      switch (row.result_flag) {
          case "M":
              stylestr += myself.Options.resultcolor_m;
              break;
          case "H":
              stylestr += myself.Options.resultcolor_h;
              break;
          case "L":
              stylestr += myself.Options.resultcolor_l;
              break;
          case "P":
              stylestr += myself.Options.resultcolor_p;
              break;
          case "W":
              stylestr += myself.Options.resultcolor_w;
              break;
          case "E":
              stylestr += myself.Options.resultcolor_e;
              break;
          case "Q":
              stylestr += myself.Options.resultcolor_r;
              break;
          default:
              stylestr += myself.Options.resultcolor_m;
              break;
      }
      if (row.result_str == "未做") {
          stylestr += ";color: #0095D9";
      }
      // console.log(row.result_flag, stylestr)
      return stylestr;
  },
  getRptitemval(myself, rptunitid, rptitemcode, rekind) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "getrptitemval",
                  rpt_itemcode: rptitemcode,
                  resultkind: rekind,
                  rptunitid: rptunitid,
              },
          })
          .then((res) => {
              // myself.tableColumnResultAll = res.Cols;
              myself.tableDataResultAll = res.Data;
              myself.tableDataResultS = res.Data;
              if (res.Data.length <= 0) myself.textvalueshow = false;
          });
  },
  queryReqItem(myself, prgno) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "queryreqitem",
                  barcode: myself.xtable3Row.barcode,
                  sampleid: myself.xtable3Row.sampleid,
                  rptunitid: myself.rptunitid,
              },
          })
          .then((response) => {
              if (response.Data) {
                  if (prgno == "BAC230") {
                      myself.$refs.reqitemdialog.DealApplyData({ Data: response.Data, Cols: myself.reqoption.Cols });
                  } else {
                      myself.$refs.reqitemdialog.DealApplyData({ Data: response.Data, Cols: [] });
                  }
              } else {
                  myself.$refs.reqitemdialog.DealApplyData({ Data: [], Cols: [] });
              }
          })
          .catch((e) => {});
  },
  //后台调用计算参考值
  calcRef(myself, row) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "calcref",
                  sex: myself.xtable3Row.pat_sex,
                  ageyear: myself.xtable3Row.pat_agestr,
                  specimen: myself.xtable3Row.specimen_code,
                  physicycle: myself.xtable3Row.physicycle,
                  deptno: myself.xtable3Row.req_deptno,
                  diagicd: myself.xtable3Row.pat_diag_icd,
                  hospcode: myself.xtable3Row.hospcode,
                  resultrow: row,
              }
          })
          .then(res => {
              for (var item in res) {
                  row[item] = res[item];
              }
              myself.ResultClassName(row);
              myself.ResultClass(row);
          })
          .catch(error => {
              myself.$message.error("错误:" + error);
          });
  },
  //键盘事件绑定
  keyEvent: {
      lisshortcutkeypageup: 33,
      lisshortcutkeypagedown: 34,
      lisshortcutkeyf2: 113, // F2 BAC224 新增
      lisshortcutkeyf6: 117, // F6 保存
      lisshortcutkeyf7: 118, // F7 //预览 打印
      lisshortcutkeyf8: 119, // F8 审核
  },
  regKeyEvent(myself, prgno) {
      var that = this;
      document.onkeydown = function(e) {
          let key = window.event.keyCode;
          switch (key) {
              case that.keyEvent.lisshortcutkeypageup:
                  myself.CollectMove(0);
                  break;
              case that.keyEvent.lisshortcutkeypagedown:
                  myself.CollectMove(1);
                  break;
              case that.keyEvent.lisshortcutkeyf6: // 保存
                  // if (!_self.btndisabled) {
                      // myself.SaveReportandResult(2, _self.selectdate, _self.rptunitid);
                  if (prgno == "BAC232") {
                      // myself.preSavepageeval(1);
                      myself.currentChangeEvent(myself.xtable3Row);
                  } else if (prgno == "BAC230") {
                      myself.saveNowdata();
                  } else if (prgno == "BAC224") {
                      myself.saveSampleInfo();
                  }
                  // }
                  break;
              case that.keyEvent.lisshortcutkeyf7:
                  // if (prgno == "BAC232") { // 预览
                  //     myself.MainDeal(6);
                  // } else if (prgno == "BAC230") {
                  //     myself.showReport(2);
                  // }
                  if (prgno == "BAC232") { // 打印
                      myself.MainDeal(5);
                  } else if (prgno == "BAC230") {
                      myself.showReport(1);
                  }
                  break;
              case that.keyEvent.lisshortcutkeyf8: // 审核
                  if (prgno == "BAC232") {
                      myself.MainDeal(3);
                  } else if (prgno == "BAC230") {
                      myself.checkReport();
                  }
                  break;
              case that.keyEvent.lisshortcutkeyf2: // BAC224 新增
                  if (prgno == "BAC224") {
                      myself.addBactseq();
                  }
                  break;
          }
      };
  },
  // 培养基分配弹窗保存事件
  addMedium(myself, prgno) {
      let updateRecords = myself.$refs.xTable7.getSelectRecords();
      if (updateRecords.length > 0) {
          var mediumnos = [];
          updateRecords.forEach((element) => {
              mediumnos.push(element.mediumno);
          });
          let url = "BAC/BAC2/BAC210";
          let param = {};
          if (prgno == "BAC210") {
              param = {
                  action: "changemedium",
                  sampleid: myself.selrow.sampleid,
                  mediumnos: mediumnos, // BAC210
              };
          } else {
              url = "BAC/BAC2/BAC230";
              param = {
                  action: "addmedium",
                  sampleid: myself.xtable3Row.sampleid,
                  mediumnostr: mediumnos, // BAC230
                  cultureid: myself.changeCulture.cultureid,
              };
          }
          myself.$tool
              .request({
                  url: url,
                  method: "post",
                  data: {
                      ...param
                  },
              })
              .then((response) => {
                  // Item1: flag, Item2: msg, Item3: row, Item4: prtbottlenos, Item5: mediumlst
                  if (response.flag == 1) {
                      myself.cancelallMedium();
                      let mediumlst = [];
                      if (response.mediumlst.length > 0) {
                          response.mediumlst.forEach(element => {
                              if (element.printorscan == "s") mediumlst.push(element); // 需要弹窗扫描的培养基
                          });
                      }
                      this.dealCode(myself, prgno, response.prtbottlenos, mediumlst);
                      // this.updatemediumList(this.selrow.sampleid, this.selrow.barcode);
                      myself.mediumList = response.mediumlst;
                      if (prgno == "BAC230" && response.culture && response.culture.length > 0) {
                          // myself.getChilddata(response.culture[0]);
                          if (myself.changeCulture.cultureid && myself.changeCulture.cultureid != 0) {
                              myself.getChilddata(response.culture[0]);
                          } else { // 如果为新增培养结果，更新树结构  response.bactculture
                              //myself.$emit("savaDatastate", 2, response.culture[0], response.cultureid, "culture", "培养", 1, "", 0, "培养", response.bactculture, response.cultureid, "","");
                          }
                          //更新树结构
                          let bactculture = response.bactculture;
                          let nodesecondchildren = response.bactculresult;
                          let nodethreechildren = response.bactwatch;
                          myself.$emit("savaDatastate", 2, response.culture[0], response.cultureid, "culture", "培养", 1, "", 0, "培养", bactculture, response.cultureid, "","",nodesecondchildren,nodethreechildren);
                      }
                  } else {
                      myself.$message({
                          showClose: true,
                          message: "错误：" + response.msg,
                          type: "error",
                      });
                  }
              })
              .catch((e) => {});
      } else {
          if (progn == "BAC210") {
              myself.$message({
                  showClose: true,
                  message: "提示：请先选择要更换的培养基！",
                  type: "warning",
              });
          } else {
              myself.$pub.message(myself, "提示：请先选择培养基！", "error");
          }
      }
  },
  dealCode(myself, prgno, prtbottlenos, mediumlst, acceptflag) { // 血培养如果有需要打印的，需要在血培养瓶分配完弹窗关闭之后，打印标签
      if (prtbottlenos && prtbottlenos.length > 0) { // 判断打印
          if (mediumlst && mediumlst.length > 0) { // 血培养打印处理
              myself.prtbottlenosflag = true;
          } else { // 一般细菌培养，直接打印
              let sampleid = "";
              if (prgno == "BAC230") {
                  if (acceptflag) {
                      sampleid = myself.xtable3Row.sampleid;
                  } else {
                      sampleid = myself.changeCulture.sampleid;
                  }
              } else {
                  sampleid = myself.selrow.sampleid;
              }
              setTimeout(() => {
                  prtbottlenos.forEach((bottleno) => {
                      if (bottleno) myself.$pub.printMediumbarcode(myself, bottleno, "1", myself.culturerptstyle, sampleid, 0, 0, 0, 1);
                  });
              }, 100);
          }
      }
      if (mediumlst && mediumlst.length > 0) { // 血培养处理
          myself.mediumlst = mediumlst;
          myself.mediumlstVisible = true;
          if (prgno == "BAC230") {
              setTimeout(() => {
                  myself.changebottlenopop();
              }, 500);
          }
      }
  },
  updatemediumList(myself, prgno, sampleid, barcode) {
      myself.$tool
          .request({
              url: "BAC/BAC2/BAC210",
              method: "post",
              data: {
                  action: "querysampleinfo",
                  barcode: barcode,
                  sampleid: sampleid,
              },
          })
          .then((response) => {
              // this.sampleInfoList = response.itemlst;
              myself.mediumList = response.mediumlst;
              if (myself.mediumList.length > 0 && myself.prtbottlenosflag) {
                  myself.mediumList.forEach((element) => {
                      if (element.bottleno) myself.$pub.printMediumbarcode(myself, element.bottleno, "1", myself.culturerptstyle, myself.selrow.sampleid, 0, 0, 0, 1);
                  });
                  myself.prtbottlenosflag = false;
              }
          })
          .catch((e) => {});
          if (prgno == "BAC210") myself.getCode();
  },

  ErrorListDeal(myself, msg, flag, type, func) {
      return new Promise((s, f) => {
          //msg消息列表
          //flag返回值标志
          //func确定后执行的函数
          //type为0是普通，type为1是危急值上报弹窗
          let InputMsg = [];
          if (flag == 2) {
              // 提示消息，只要显示一下就可以
              //if (msg.showMsg.length > 0) {
              this.ErrorCPOne(myself, 0, msg.showMsg, 0, func, InputMsg).then(() => {
                  s();
              });
              //}
          }
          //if (flag == -2 || flag == -3 || flag == 4) {
          if (flag == -1 || flag == -2 || flag == -3 || flag == 4) {
              // -2 -3 是确认消息 4 是需要录入的消息
              var msglist = [];
              if (msg.errorMsg) {
                  for (let i = 0; i < msg.errorMsg.length; i++) {
                      msg.errorMsg[i].errflag = "1";
                      msglist.push(msg.errorMsg[i]);
                  }
              }
              if (msg.confirmDefNoMsg) {
                  for (let i = 0; i < msg.confirmDefNoMsg.length; i++) {
                      msglist.push(msg.confirmDefNoMsg[i]);
                  }
              }
              if (msg.confirmDefYesMsg) {
                  for (let i = 0; i < msg.confirmDefYesMsg.length; i++) {
                      msglist.push(msg.confirmDefYesMsg[i]);
                  }
              }
              if (msg.inputMsg && msg.inputMsg.length > 0) {
                  for (let i = 0; i < msg.inputMsg.length; i++) {
                      msglist.push(msg.inputMsg[i]);
                      InputMsg.push({ keycode: msg.inputMsg[i].keycode, msg: { title: "", content: "" } });
                  }
              }
              // console.log(msglist)
              if (msglist.length == 1) {
                  if (msg.errorMsg.length > 0) {
                      if (myself.Options && myself.Options.hasOwnProperty("caninputnoreqbarcode") && (myself.Options.caninputnoreqbarcode == "1" && msg.errorMsg[0].content.indexOf("未找到申请单信息") > -1)) {
                          s();
                      } else {
                          this.ErrorCPOne(myself, 0, msg.errorMsg, 0, func, InputMsg).then(() => {
                              f();
                          });
                      }
                  } else if (msg.confirmDefNoMsg.length > 0) {
                      this.ErrorCPOne(myself, 3, msg.confirmDefNoMsg, 0, func, InputMsg)
                          .then(() => {
                              s();
                          })
                          .catch(() => {
                              f();
                          });
                  } else if (msg.confirmDefYesMsg.length > 0) {
                      this.ErrorCPOne(myself, 2, msg.confirmDefYesMsg, 0, func, InputMsg)
                          .then(() => {
                              s();
                          })
                          .catch(() => {
                              f();
                          });
                  } else {
                      this.ErrorCPOne(myself, 1, msg.inputMsg, 0, func, InputMsg)
                          .then(() => {
                              s();
                          })
                          .catch(() => {
                              f();
                          });
                  }
              } else {
                  this.ErrorCPOne(myself, 4, msglist, 0, func, InputMsg)
                      .then(() => {
                          s();
                      })
                      .catch(() => {
                          f();
                      });
              }
          }
      });
  },
  ErrorCPOne(myself, type, list, i, func, InputMsg) {
      // console.log(type, list, i, func, InputMsg)
      myself.InputMsg = InputMsg;
      //type=0 显示消息，type=1 输入消息，type=2 焦点在是提示消息,type=3 焦点在否提示消息
      return new Promise((s, f) => {
          if (list.length == 1) {
              if (type == 0) {
                  myself.$confirm(`<span style="font-weight:bold;color:red;font-size:16px;">${list[i].content ? list[i].content.replace(/\r\n/g,"<br/>") : "错误"}</span>`, list[i].title ? list[i].title : "提示", {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      focusCancelButton: false,
                      closeOnClickModal: false,
                      showCancelButton: false,
                      dangerouslyUseHTMLString: true,
                      type: "warning"
                  })
                  .then(the => {
                      s();
                  })
                  .catch(cat => {
                      //只是显示的消息，没有取消按钮 无论如何都应该都进.then  s()
                      s();
                  });
              } else if (type == 2 || type == 3) {
                  myself.$confirm(`<span style="font-weight:bold;color:red;font-size:16px;">${list[i].content ? list[i].content.replace(/\r\n/g,"<br/>") : "错误"}</span>`, list[i].title ? list[i].title : "提示", {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      focusCancelButton: type == 3,
                      closeOnClickModal: false,
                      dangerouslyUseHTMLString: true,
                      type: "warning"
                  })
                  .then(the => {
                      s();
                  })
                  .catch(cat => {
                      f(); //一旦用户选择了【取消】则直接退出
                  });
              } else if (type == 1) {
                  if (list[i].msg.content.indexOf("解除审核") > -1) {
                      myself.inputkeycode = list[i].keycode;
                      myself.unreasoncheckmsg = "";
                      myself.Submitdisabled = true;
                      myself.$refs.uncheckdialog
                          .ShowDialog()
                          .then(() => {
                              var data = InputMsg.find(item => item.keycode == myself.inputkeycode);
                              data.msg.content = myself.unreasoncheckmsg;
                              s();
                          })
                          .catch(() => {
                              f();
                          });
                  } else {
                      myself.$prompt("请输入" + list[i].msg.content, list[i].msg.title ? list[i].msg.title : "提示", {
                          confirmButtonText: "确定",
                          cancelButtonText: "取消",
                          showCancelButton: false,
                          cancelButtonClass: "el-button el-button--default el-button--small el-button--primary",
                          confirmButtonClass: "el-button el-button--default el-button--small",
                          focusCancelButton: false,
                          closeOnClickModal: false,
                          inputValidator: v => {
                              if (!v || v == "" || v == null) return "输入的内容不能为空";
                          },
                          beforeClose: (action, instance, done) => {
                              if (action === "confirm") {
                                  done();
                              } else {
                                  f();
                                  done();
                              }
                          }
                      }).then(({ value }) => {
                          var onemsg = InputMsg.filter(item => item.keycode == list[i].keycode);

                          if (onemsg && onemsg.length > 0) {
                              onemsg[0].msg.content = value;
                          }
                          //this.InputMsg.push({ keycode: list[i].keycode, msg: { title: "", content: value } });
                          s();
                      });
                  }
              } else {
                  s();
              }
          } else {
              myself.msglist = list;
              myself.$refs.msgdialog
                  .ShowDialog()
                  .then(() => {
                      s();
                  })
                  .catch(() => {
                      f();
                  });
              // this.dialogMsgVisible = true;
          }
      });
  },
  getSamplequality(myself, samplequality) { // 更新样本质量
      if (samplequality) myself.sampleQuality = "sample-quality" + samplequality;
      if (samplequality == 1) myself.samplequalityname = "优";
      if (samplequality == 2) myself.samplequalityname = "合格";
      if (samplequality == 3) myself.samplequalityname = "差";
  },
  setReportAndCheckuser(myself, report_username, rechk_username) {
      myself.$tool.statusbarMsg(3, "<span style='color:red;'>检验者: " + (report_username ? report_username : "") + "</span><span style='color:red;margin-left:5px'>审核者: " + (rechk_username ? rechk_username : "") + "</span>");
  },
  updateReportuser(myself) {
      if (myself.usesamplereportuserflag == "1") {
          this.setReportAndCheckuser(myself, myself.xtable3Row.report_username, myself.rechkusername);
          myself.reportuser = myself.xtable3Row.report_user;
      } else {
          this.setReportAndCheckuser(myself, myself.defaultReportuser.report_username, myself.rechkusername);
          myself.reportuser = myself.defaultReportuser.report_user;
      }
  },
  //消息回看输入框双击事件，目前仅支持解除审核原因开窗选择
  msgDblClick(myself, content, keycode) {
      myself.errorListMsg = false;
      if (keycode) myself.inputkeycode = keycode;
      myself.uncheckReasonDataDialog = true;
  },
  uncheckInput(myself, val) {
      if (val) myself.Submitdisabled = false;
      else myself.Submitdisabled = true;
  },
  Uncheckchange(myself, code, name) {
      if (myself.errorListMsg) {
          var item = myself.InputMsg.find(item => item.keycode == myself.inputkeycode);
          if (item) item.msg.content = name;
      } else {
          myself.unreasoncheckmsg = name;
          myself.Submitdisabled = false;
      }
      myself.uncheckReasonDataDialog = false;
  },
  closeErrorDialog(myself, type) {
      if (type == 1) {
          myself.$refs.msgdialog.Confirm();
      } else {
          myself.$refs.msgdialog.Cancel();
      }
  },
  changeUncRDataDialog(myself, type, keycode) {
      if (type == 1) {
          myself.errorListMsg = true;
          myself.inputkeycode = keycode;
          myself.uncheckReasonDataDialog = true;
      } else {
          myself.uncheckReasonDataDialog = false;
      }
  },
  // 报告预览、打印
  printReport(myself, printorview) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "printreport",
                  sampleid: myself.xtable3Row.sampleid,
                  printorview: printorview,
                  labgroupid: myself.searchParam.labgroupid,
              },
          })
          .then((response) => {
              if (response.flag == 1) {
                  this.PrintFunc(myself, printorview, response.reportid);
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag);
              }
          });
  },
  PrintFunc(myself, type, reportid) {
      const loading = myself.$loading({
          lock: true,
          text: "打印中",
          spinner: "el-icon-loading",
          background: "rgba(0, 0, 0, 0.7)",
      });
      myself.$pub.printreport(myself, reportid, type, "", "1", "1");
      loading.close();
  },
  judgeUserOrCA(myself, prgno, reporttype) {
      if (!myself.CheckUser) {
          if (myself.rechkdefaultuseloginuserflag == "1") { // 使用当前登录人作为审核者
              myself.CheckUser = myself.$tool.getSession(myself.$tool.loginuserno);
              myself.rechkusername = myself.$tool.getSession(myself.$tool.loginusername);
              myself.CurrentCheckUser = { userno: myself.CheckUser, username: myself.rechkusername };
              this.checkCaReport(myself, prgno);
          } else {
              this.chkUserConfirm(myself, prgno, 1, reporttype);
          }
      } else {
          this.checkCaReport(myself, prgno);
      }
  },
  chkUserConfirm(myself, prgno, type, updatereportidflag, reporttype, compchild, resulttype) {
      // resulttype: BAC230 审核时第一次请求传“smear”，第二次传空值
      // console.log(myself, prgno, type, updatereportidflag)
      myself.$rm_Login({
          type: "请输入审核者工号和密码",
          btn: {
              confirmBtnText: "确定",
              cancelBtnText: "取消",
          },
      })
          .then((res) => {
              if (res.flag == "1") {
                  // if (!compchild) {
                      myself.CheckUser = res.userid;
                      myself.rechkusername = res.username;
                  // } else {
                  //     myself.updateCheckUser("", res.userid, res.username);
                  //     console.log(myself.CheckUser)
                  // }
                  if (type == 1) {
                      // if (prgno == "BAC227") {
                      if (reporttype == "prereport") {
                          this.checkPreMedCaReport(myself, prgno);
                      } else {
                          if (reporttype == "releasereport") {
                              var evalid = 0;
                              if (prgno == "BAC230") {
                                  evalid = myself.changeEval.evalid;
                              } else {
                                  evalid = myself.$refs.bactTable.getCurrentRow().evalid;
                              }
                              this.checkCaReport(myself, prgno, updatereportidflag, evalid);
                          } else {
                              this.checkCaReport(myself, prgno, updatereportidflag, "", resulttype);
                          }
                      }
                      if (!compchild) {
                          myself.CurrentCheckUser = { userno: myself.CheckUser, username: myself.rechkusername };
                      } else {
                          myself.updateCheckUser(1, res.userid, res.username);
                      }
                  } else {
                      myself.$pub.message(myself, "重置成功！", "success");
                  }
                  if (prgno != "BAC227") {
                      if (!compchild) {
                          if (myself.usesamplereportuserflag == "1") {
                              this.setReportAndCheckuser(myself, myself.xtable3Row.report_username, myself.rechkusername);
                          } else {
                              this.setReportAndCheckuser(myself, myself.defaultReportuser.report_username, myself.rechkusername);
                          }
                      } else {
                          myself.updateCheckUser(2, res.userid, res.username);
                      }
                  }
              } else {
                  //登录失败
              }
          })
          .catch((e) => {});
          myself.clickflag = false;
  },
  checkCaReport(myself, prgno, updatereportidflag, evalid, resulttype) { // 增加审核CA判断
      // resulttype: BAC230 审核时第一次请求传“smear”，第二次传空值
      if (myself.bactreportcheckusecaflag == "1") {
          this.checkCaLogin(myself, myself.CheckUser).then(cares => {
              if (cares.flag == "1") {
                  this.checkReport(myself, prgno, updatereportidflag, evalid, resulttype);
              } else {
                  myself.$alert("CA登录失败！" + cares.msg, "登陆失败", {
                      confirmButtonText: "确定",
                      type: "error"
                  });
              }
          });
      } else {
          this.checkReport(myself, prgno, updatereportidflag, evalid, resulttype);
      }
      myself.clickflag = false;
  },
  checkReport(myself, prgno, updatereportidflag, evalid, resulttype) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "checkreport",
                  prgno: prgno,
                  labgroupid: prgno == "BAC230" && evalid > 0 ? myself.labgroupid : myself.searchParam.labgroupid,
                  sampleid: myself.xtable3Row.sampleid,
                  // results: this.$refs.bactTable.getRecordset(),
                  // meds: this.tableDataResultAll, // this.$refs.medTable.getRecordset()
                  checkuser: myself.CheckUser,
                  updatereportidflag: updatereportidflag,
                  reportuser: myself.defaultReportuser.report_user,
        evalid: evalid,
                  resulttype: resulttype,
              },
          })
          .then((response) => {
              if (response.flag == 1) {
                  if (response.alertflag == 1) {
                      myself.reportid = response.reportid;
                      myself.bactreportid = response.bactreportid;
                      myself.dialogDangerVisible = true;
                  } else {
                      if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                          this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                              this.dealCheckReport(myself, prgno, updatereportidflag, response, "", evalid, resulttype);
                          })
                          .catch(() => {
                              this.dealCheckReport(myself, prgno, updatereportidflag, response, "CA签名失败!", evalid, resulttype);
                          });
                      } else {
                          this.dealCheckReport(myself, prgno, updatereportidflag, response, "", evalid, resulttype);
                      }
                  }
              } else if (response.flag == -1) {
                  if (response.msg.errorMsg.length > 0) {
                      this.ErrorListDeal(myself, response.msg, response.flag, 0);
                  }
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag, 0)
                      .then(() => {
                          if (response.alertflag == 1) {
                              myself.bactreportid = response.bactreportid;
                              // 危急值弹窗
                              myself.reportid = response.reportid;
                              myself.dialogDangerVisible = true;
                          } else {
                              myself.bactreportid = response.bactreportid;
                              myself.reportid = response.reportid;
                              this.execCheckReport(myself, prgno, updatereportidflag, "", "", evalid, resulttype);
                          }
                      })
                      .catch(() => {
                          // console.log("ErrorListDeal catch");
                      });
              }
          })
          .catch((e) => {});
  },
  dealCheckReport(myself, prgno, updatereportidflag, response, msg, evalid, resulttype) {
      if (updatereportidflag == 1) {//1为不更新bact_sample表中的reportid
          myself.$pub.message(myself, "发布成功！" + msg, "success");
          if (prgno == "BAC230" && evalid > 0) { // 更新树结构中鉴定数据
              myself.$emit("savaDatastate", 2, response.noweval[0], myself.changeEval.evalid, "eval", "鉴定、药敏", 1, "", 0, "鉴定、药敏", response.bacteval, response.evalid, "", response.bactreport);
          } else {
              myself.querySampleInfo(myself.xtable3Row.sampleid);
          }
      } else {
          if (prgno == "BAC230" && resulttype == "smear") {
              console.log('2 = checkreport');
              // 第一次调审核接口，不刷新数据，直接执行第二次调审核接口，resulttype 传空值， 第二次成功之后再刷新
              myself.resulttype = "";
              this.checkCaReport(myself, "BAC230", "", "", "");
          } else {
              myself.$pub.message(myself, "审核成功！" + msg, "success");
              myself.xtable3Row.rechk_dt = response.rechk_dt;
              myself.xtable3Row.rechk_user = myself.rechkusername;
              if (response.link && response.link.length > 0) { // 关联样本弹窗优先，有关联样本不跳下一个
                  myself.linkList = response.link;
                  myself.linkrptVisible = true;
                  myself.querySampleInfo(myself.xtable3Row.sampleid);
              } else {
                  if (myself.rechk2nextsmpflag == "1") { // 跳下一个样本
                      myself.CollectMove(1);
                  } else {
                      if (prgno == "BAC232") {
                          myself.querySampleInfo(myself.xtable3Row.sampleid);
                      } else if (prgno == "BAC230") {
                          myself.checkflag = true; // 审核、解审时更新数据不执行保存操作
                          myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.purposeno);
                      }
                  }
              }
          }
      }
  },
  execCheckReport(myself, prgno, alertreportflag, alertinfo, updatereportidflag, evalid, resulttype) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "execcheckreport",
                  prgno: prgno,
                  reportid: myself.reportid,
                  rechkuser: myself.CheckUser,
                  inputmsg: myself.InputMsg,
                  sampleid: myself.xtable3Row.sampleid,
                  labgroupid: prgno == "BAC230" && evalid > 0 ? myself.labgroupid : myself.searchParam.labgroupid,
                  // refId: this.bactreportid
                  alertreportflag: alertreportflag,
                  alertinfo: alertinfo,
                  updatereportidflag: updatereportidflag,
                  reportuser: myself.defaultReportuser.report_user,
                  evalid: evalid,
                  resulttype: resulttype,
                  bactreportid: myself.bactreportid,
              },
          })
          .then((response) => {
              if (alertreportflag) { // 危急值上报
                  if (response.flag == 1) {
                      if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                          this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                              myself.exeDangerreport(alertreportflag, updatereportidflag, response, "", resulttype);
                          })
                          .catch(() => {
                              myself.exeDangerreport(alertreportflag, updatereportidflag, response, "CA签名失败!", resulttype);
                          });
                      } else {
                          myself.exeDangerreport(alertreportflag, updatereportidflag, response, "", resulttype);
                      }
                      // if (alertreportflag == 1) {
                      //     this.$pub.message(this, "上报成功！", "success");
                      // } else {
                      //     this.$pub.message(this, "审核成功！", "success");
                      // }
                      // this.dialogDangerVisible = false;
                      // if (updatereportidflag != 1) {// 审核，1为不更新bact_sample表中的reportid
                      //     this.xtable3Row.rechk_dt = response.rechk_dt;
                      //     this.xtable3Row.rechk_user = this.rechkusername;
                      //     if (response.link && response.link.length > 0) {
                      //         this.linkList = response.link;
                      //         this.linkrptVisible = true;
                      //         this.querySampleInfo(this.xtable3Row.sampleid);
                      //     } else {
                      //         if (this.rechk2nextsmpflag == "1") { // 跳下一个样本
                      //             this.CollectMove(1);
                      //         } else {
                      //             this.querySampleInfo(this.xtable3Row.sampleid);
                      //         }
                      //     }
                      // } else { // 发布操作
                      //     this.querySampleInfo(this.xtable3Row.sampleid);
                      // }
                  } else {
                      var errorMsg = response.msg.errorMsg;
                      myself.$confirm(errorMsg[0].content ? errorMsg[0].content : "错误", errorMsg[0].title ? errorMsg[0].title : "提示", {
                          confirmButtonText: "确定",
                          // cancelButtonText: "取消",
                          focusCancelButton: false,
                          closeOnClickModal: false,
                          showCancelButton: false,
                          type: "warning",
                      });
                  }
              } else { // 正常审核
                  if (response.flag == 1) {
                      if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                          this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                              this.dealCheckReport(myself, prgno, updatereportidflag, response, "", evalid, resulttype);
                          })
                          .catch(() => {
                              this.dealCheckReport(myself, prgno, updatereportidflag, response, "CA签名失败!", evalid, resulttype);
                          });
                      } else {
                          this.dealCheckReport(myself, prgno, updatereportidflag, response, "", evalid, resulttype);
                      }
                      // if (updatereportidflag == 1) {//1为不更新bact_sample表中的reportid
                      //     this.$message({
                      //         showClose: true,
                      //         message: "发布成功！",
                      //         type: 'success'
                      //     });
                      // } else {
                      //     this.$message({
                      //         showClose: true,
                      //         message: "审核成功！",
                      //         type: 'success'
                      //     });
                      //     this.xtable3Row.rechk_dt = response.rechk_dt;
                      //     this.xtable3Row.rechk_user = this.rechkusername;
                      //     if (response.link.length > 0) {
                      //         this.linkList = response.link;
                      //         this.linkrptVisible = true;
                      //     }
                      // }
                      // this.querySampleInfo(this.xtable3Row.sampleid);
                  } else {
                      var errorMsg = response.msg.errorMsg;
                      myself.$confirm(errorMsg[0].content ? errorMsg[0].content : "错误", errorMsg[0].title ? errorMsg[0].title : "提示", {
                          confirmButtonText: "确定",
                          // cancelButtonText: "取消",
                          focusCancelButton: false,
                          closeOnClickModal: false,
                          showCancelButton: false,
                          type: "warning",
                      });
                  }
              }
          })
          .catch((e) => {});
          if (prgno == "BAC230") myself.resulttype = ""; // 危急值处理完成之后，手动将 resulttype 置空，便于执行第二次审核
  },
  // CA 判断
  checkCaLogin(myself, rckuser) {
      if (typeof jsObj != "undefined") {
          jsObj.Log('调用ca登录: ' + myself.CheckUser);
      }
      return new Promise((s, f) => {
          // if (this.Options.useca == "1") {
          myself.$ca.checklogin("rptchk", rckuser).then(cares => {
              s(cares);
          });
          // } else {
          //     s({ flag: "1" });
          // }
      });
  },
  ReportCheckCA(myself, res, rechkuser) {
      return new Promise((s, f) => {
          let chkuser = rechkuser;
          // if (!chkuser) {
          //     chkuser = !this.PatientInfo.rechk_user || this.specinuseflaginrecord == "2" ? this.exactusernorhk : this.PatientInfo.rechk_user;
          //     if (this.Options.rechkcoverechkuser == "1") {
          //         chkuser = this.exactusernorhk;
          //     }
          // }
          // this.caLogcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :开始电子签名: " + res.reporttoca.reportid + "\r\n";
          //CA签名数据保存，不管成功或失败，都不影响审核 加密和保存加密数据都集成到CAsign方法
          myself.$ca.CAsign(chkuser, res.reporttoca.data, res.reporttoca.reportid).then(caret => {
              // this.caLogcontent += XE.toDateString(new Date(), "yyyy-MM-dd HH:mm:ss.S") + " :电子签名结束: " + res.reporttoca.reportid + "\r\n";
              //this.$pub.Log("电子签名结束");
              console.log('caret',caret);
              if (caret.flag != "1") {
                  myself.$pub.Log("CA签名失败(bact)：chkuser=" + chkuser + "reportid = " + res.reporttoca.reportid + ",data=" + res.reporttoca.data);
                  f();
              } else {
                  s();
              }
          });
      });
  },
  unCheckReport(myself, prgno) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "uncheckreport",
                  prgno: prgno,
                  sampleid: myself.xtable3Row.sampleid,
                  labgroupid: myself.searchParam.labgroupid,
              },
          })
          .then((response) => {
              if (response.flag == 1) {
                  myself.$pub.message(myself, "解审成功！", "success");
                  myself.xtable3Row.rechk_dt = "";
                  myself.xtable3Row.rechk_user = "";
                  if (prgno == "BAC232") {
                      myself.querySampleInfo(myself.xtable3Row.sampleid);
                  } else if (prgno == "BAC230") {
                      myself.checkflag = true; // 审核、解审时更新数据不执行保存操作
                      myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.purposeno);
                  }
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag).then(() => {
                      this.execuncheckreport(myself, prgno, response.reportid);
                  });
              }
          })
          .catch((e) => {});
  },
  execuncheckreport(myself, prgno, reportid, updatereportidflag, evalid) {
      return new Promise((s, f) => {
          myself.$tool
              .request({
                  url: "ucent/bactcomm",
                  method: "post",
                  data: {
                      action: "execuncheckreport",
                      labgroupid: prgno == "BAC230" && evalid > 0  ? myself.labgroupid : myself.searchParam.labgroupid,
                      prgno: prgno,
                      sampleid: myself.xtable3Row.sampleid,
                      reportid: reportid,
                      inputmsg: myself.InputMsg,
                      updatereportidflag: updatereportidflag,
                      evalid: evalid,
                  },
              })
              .then((response) => {
                  if (response.flag == 1) {
                      if (prgno == "BAC230" && evalid > 0) {
                          myself.$pub.message(myself, "召回成功！", "success");
                          myself.$emit("savaDatastate", 2, response.noweval[0], myself.changeEval.evalid, "eval", "鉴定、药敏", 1, "", 0, "鉴定、药敏", response.bacteval, response.evalid, "", response.bactreport);
                      } else {
                          myself.$pub.message(myself, "解审成功！", "success");
                          myself.xtable3Row.rechk_dt = "";
                          myself.xtable3Row.rechk_user = "";
                          if (prgno == "BAC232") {
                              myself.querySampleInfo(myself.xtable3Row.sampleid);
                          } else if (prgno == "BAC230") {
                              myself.checkflag = true; // 审核、解审时更新数据不执行保存操作
                              myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.purposeno);
                          }
                      }
                      s();
                  } else if (response.flag == -1) {
                      myself.$alert(!response.msg.errorMsg[0].content ? "解审失败！" : response.msg.errorMsg[0].content).then(() => {
                          f();
                      });
                  }
              });
      });
  },
  // 菌落观察发布报告
  beforesendlevel2report(myself, prgno) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "beforesendlevel2report",
                  labgroupid: prgno == "BAC224" ? myself.searchParam.labgroupid : myself.labgroupid,
                  sampleid: myself.xtable3Row.sampleid,
                  bactseq: prgno == "BAC224" ? myself.bactList[myself.nowTab].info.bactseq : myself.changeWatch.bactseq,
              }
          })
          .then(response => {
              if (response.flag == 1) {
                  myself.$rm_Login({ // 登录
                      type: "请输入审核者工号和密码",
                      btn: {
                          confirmBtnText: "确定",
                          cancelBtnText: "取消"
                      },
                      alertflag: prgno != "BAC224" ,
                  }).then(res => {
                      if (res.flag == "1") {
                          myself.CheckUser = res.userid;
                          myself.rechkusername = res.username;
                          myself.CurrentCheckUser = { userno: myself.CheckUser, username: myself.rechkusername };
                          myself.alertType = 2;
                          //myself.secondalertflag = res.loginalertflag;
                          //BAC224发布二级报告，危急值选项直接在页面上选择，已经给字段secondalertflag赋值了
                          if(prgno=='BAC224'){
                              this.setReportAndCheckuser(myself, myself.defaultReportuser.report_username, myself.rechkusername);
                          }else{
                              myself.secondalertflag = res.loginalertflag;
                          }
                          //that.nowEvalid = response.evalid;
                          //先不发布关联样本的二级报告
                          // if (response.linklist.length > 0) {
                          //     // 发布危急值，判断有无关联样本
                          //     that.alertEvalid = response.evalid;
                          //     response.linklist.forEach(element => {
                          //         element.chkflag = "1";
                          //     });
                          //     that.linkList = response.linklist;
                          //     that.linkListVisible = true;
                          // } else {
                          //     that.sendAlertreportevalCa(response.evalid, that.xtable3Row.sampleid);
                          // }
                          this.sendAlertreportevalCa(myself, prgno, response.bactseq, myself.xtable3Row.sampleid);
                      } else {
                          //登录失败
                      }
                  })
                  .catch(() => {
                      if (prgno != "BAC230") {
                          myself.getCode();
                      }
                  });
              } else {
                  myself.$pub.message(myself, "错误:" + response.msg, "error");
              }
          })
          .catch(e => {});
  },
  sendAlertreportevalCa(myself, prgno, bactseq, sampleid) { // 增加审核CA判断
      if (myself.bactreportcheckusecaflag == "1") {
          this.checkCaLogin(myself, myself.CheckUser).then(cares => {
              if (cares.flag == "1") {
                  // this.sendAlertreporteval(bactseq, sampleid);
                  this.sendAlertreporteval(myself, prgno, bactseq, sampleid);
              } else {
                  myself.$alert("CA登录失败！" + cares.msg, "登陆失败", {
                      confirmButtonText: "确定",
                      type: "error"
                  });
              }
          });
      } else {
          // this.sendAlertreporteval(bactseq, sampleid);
          this.sendAlertreporteval(myself, prgno, bactseq, sampleid);
      }
  },
  sendAlertreporteval(myself, prgno, bactseq, sampleid) {
      myself.execotherparam = {},
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "sendlevel2report",
                  labgroupid: prgno == "BAC224" ? myself.searchParam.labgroupid : myself.labgroupid,
                  sampleid: sampleid,
                  bactseq: bactseq,
                  alertflag: myself.secondalertflag,
                  rechkuser: myself.CheckUser,
                  prgno: prgno,
                  bactwatchdetid: prgno == "BAC230" ? myself.changeWatch.bactwatchdetid : "",
              }
          })
          .then(response => {
              console.log('response',response);
              myself.execotherparam = {
                  reportid: response.reportid,
                  bactreportid: response.bactreportid,
                  sampleid: sampleid,
                  bactseq: bactseq,
                  smearid: response.smearid,
              };
              myself.reportid = response.reportid;
              if (response.flag == 1) {
                  if (response.alertflag == 1) {
                      // 危急值弹窗
                      myself.alertType = 2;
                      myself.dialogDangerVisible = true;
                      // this.awaitAlertFlag = true;// 暂不考虑关联样本连续上报危急值，暂时注释掉
                  } else {
                      if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                          this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                              myself.$pub.message(myself, "发布成功！", "success");
                          })
                          .catch(() => {
                              myself.$pub.message(myself, "发布成功！CA签名失败!", "success");
                          });
                      } else {
                          myself.$pub.message(myself, "发布成功！", "success");
                      }
                      // this.$pub.message(this, "发布成功！", "success");
                      if (prgno == "BAC224") {
                          myself.querySampleInfo(myself.xtable3Row);
                      } else if (prgno == "BAC230") {
                          // myself.$emit("updateTreedata");
                          // 只更新当前树节点下的数据状态
                          myself.$emit("savaDatastate", 2, response.watchdet[0], myself.changeWatch.bactwatchdetid, "watch", "菌落观察", 1, "", 0, "菌落观察", response.bactwatch, response.bactwatchdetid, "", response.bactreport);
                          //培养下的节点也要处理
                          let bactculture = response.bactculture;
                          let nodesecondchildren = response.bactculresult;
                          let nodethreechildren = response.bactwatch;
                          myself.$emit("savaDatastate", 2, response.watchdet[0], myself.changeWatch.bactwatchdetid, "culture", "培养", 1, "", 0, "培养", bactculture, response.bactwatchdetid, "", response.bactreport,nodesecondchildren,nodethreechildren);
                      }
                  }
              } else if (response.flag == -1) {
                  if (response.msg.errorMsg.length > 0) {
                      this.ErrorListDeal(myself, response.msg, response.flag, 0);
                  }
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag, 0)
                      .then(() => {
                          if (response.alertflag == 1) {
                              // 危急值弹窗
                              myself.alertType = 2;
                              myself.dialogDangerVisible = true;
                              myself.awaitAlertFlag = true;
                          } else {
                              this.execsendlevel2report(myself, prgno, "", "");
                          }
                      })
                      .catch(() => {
                          // console.log("ErrorListDeal catch");
                      });
              }
          })
          .catch(e => {});
  },
  execsendlevel2report(myself, prgno, alertreportflag, alertinfo) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "execsendlevel2report",
                  reportid: myself.execotherparam.reportid,
                  checkuser: myself.CheckUser,
                  inputmsg: myself.InputMsg,
                  alertreportflag: alertreportflag,
                  alertinfo: alertinfo,
                  bactseq: myself.execotherparam.bactseq,
                  sampleid: myself.execotherparam.sampleid,// 注意此处，如果是关联样本连续发布二级报告的话，这个样本ID参数是需要改变的
                  smearid: myself.execotherparam.smearid,
                  bactreportid: myself.execotherparam.bactreportid,
                  prgno: prgno,
                  bactwatchdetid: prgno == "BAC230" ? myself.changeWatch.bactwatchdetid : "",
              }
          })
          .then(response => {
              myself.dialogDangerVisible = false;
              if (response.flag == 1) {
                  if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                      this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                          myself.$pub.message(myself, "发布成功！", "success");
                      })
                      .catch(() => {
                          myself.$pub.message(myself, "发布成功！CA签名失败!", "success");
                      });
                  } else {
                      myself.$pub.message(myself, "发布成功！", "success");
                  }
                  // this.$pub.message(this, "发布成功！", "success");
                  if (prgno == "BAC224") {
                      myself.querySampleInfo(myself.xtable3Row);
                  } else if (prgno == "BAC230") {
                      // myself.$emit("updateTreedata");
                      // 只更新当前树节点下的数据状态
                      myself.$emit("savaDatastate", 2, response.watchdet[0], myself.changeWatch.bactwatchdetid, "watch", "菌落观察", 1, "", 0, "菌落观察", response.bactwatch, response.bactwatchdetid, "", response.bactreport);
                      //培养下的节点也要处理
                      let bactculture = response.bactculture;
                      let nodesecondchildren = response.bactculresult;
                      let nodethreechildren = response.bactwatch;
                      myself.$emit("savaDatastate", 2, response.watchdet[0], myself.changeWatch.bactwatchdetid, "culture", "培养", 1, "", 0, "培养", bactculture, response.bactwatchdetid, "", response.bactreport,nodesecondchildren,nodethreechildren);
                  }
                  myself.continueAlert();
              } else {
                  var errorMsg = response.msg.errorMsg;
                  myself.$confirm(errorMsg[0].content ? errorMsg[0].content : "错误", errorMsg[0].title ? errorMsg[0].title : "提示", {
                      confirmButtonText: "确定",
                      // cancelButtonText: "取消",
                      focusCancelButton: false,
                      closeOnClickModal: false,
                      showCancelButton: false,
                      type: "warning"
                  })
                      .then(() => {
                          myself.continueAlert();
                      })
                      .catch(() => {
                          myself.continueAlert();
                      });
              }
          })
          .catch(e => {});
  },
  //危急值弹窗 取消审核
  cancelsendlevel2report(myself, prgno){
      myself.$tool
      .request({
          url: "ucent/bactcomm",
          method: "post",
          data: {
              action: "cancelsendlevel2report",
              reportid: myself.execotherparam.reportid,
              bactseq: myself.execotherparam.bactseq,
              smearid: myself.execotherparam.smearid,
              bactreportid: myself.execotherparam.bactreportid,
              prgno: prgno,
          }
      })
      .then(res=>{
          console.log("res",res);
      })
  },
  // 菌落观察召回报告
  callbackWatchAlert(myself, row, execflag, type, prgno) { // 根据 type 判断召回成功之后执行 修改菌株名 或 删除菌株名 或者 删除菌株
      if (!row.reportid) return false;
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "callbackwatchalert",
                  sampleid: myself.xtable3Row.sampleid,
                  bactwatchdetid: prgno == "BAC224" ? myself.bactList[myself.nowTab].info.bactwatchdetid : row.bactwatchdetid,
                  callback_reportid: row.reportid,
                  execflag: execflag,
                  prgno: prgno,
              },
          })
          .then((response) => {
              if (response.flag == 1) {
                  myself.$pub.message(myself, "召回成功！", "success");
                  if (prgno == "BAC224") {
                      myself.bactList[myself.nowTab].info.reportid = "";
                      myself.bactList[myself.nowTab].info.alertflag = "";
                      if (type == "deletename") {
                          myself.deleteRptitem(myself.nowTab);
                      } else if (type == "changename") {
                          myself.dialogRptVisible = true;
                      } else if (type == "deletebact") {
                          myself.cardDeal(7, myself.nowTab);
                      }
                  } else if (prgno == "BAC230") {
                      if (type == "deletebact") {
                          myself.execDeleteNode("菌落观察", response.watchdet[0], "");
                      } else {
                          // myself.$emit("updateTreedata");
                          // 只更新当前树节点下的数据状态
                          myself.$emit("savaDatastate", 2, response.watchdet[0], myself.changeWatch.bactwatchdetid, "watch", "菌落观察", 1, "", 0, "菌落观察", response.bactwatch, response.bactwatchdetid, "", response.bactreport);
                          //培养下的节点也要处理
                          let bactculture = response.bactculture;
                          let nodesecondchildren = response.bactculresult;
                          let nodethreechildren = response.bactwatch;
                          myself.$emit("savaDatastate", 2, response.watchdet[0], myself.changeWatch.bactwatchdetid, "culture", "培养", 1, "", 0, "培养", bactculture, response.bactwatchdetid, "", response.bactreport,nodesecondchildren,nodethreechildren);
                      }
                  }
              } else if (response.flag == -1) {
                  // this.$message.error("错误：" + response);
                  this.ErrorListDeal(myself, response.msg, response.flag, 0);
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag, 0)
                      .then(() => {
                          // this.bactreportid = response.bactreportid;
                          // this.execCheckReport(type, '', '', response.smearid);
                          if (response.otherflag == 1) {
                              this.uncheckreportotheroper(myself, prgno, response.callback_reportid);
                          } else {
                              myself.callbackAlert(row, 1, type);
                          }
                      })
                      .catch(() => {
                          // console.log("ErrorListDeal catch");
                      });
              }
          })
  },
  // 菌落观察删除菌株
  execdeleteBactwatch(myself, prgno) {
      myself.$refs.ruleForm.validate(valid => {
          console.log(valid);
          if (valid) {
              myself.$tool
                  .request({
                      url: "BAC/BAC2/BAC224",
                      method: "post",
                      data: {
                          action: "deletebactwatch",
                          sampleid: myself.xtable3Row.sampleid,
                          bactseq: prgno == "BAC224" ? myself.bactList[myself.nowTab].info.bactseq : myself.delNodedata.bactseq,
                          reason: myself.ruleForm.deleteReason,
                          labgroupid: myself.searchParam.labgroupid,
                      }
                  })
                  .then(response => {
                      if (response.flag == 1) {
                          myself.closeDeleteDialog();
                          myself.deleteCulresultVisible = false;
                          // that.$message.success("删除成功！");
                          if (prgno == "BAC224") {
                              myself.bactList.splice(myself.nowTab, 1);
                              myself.logs = response.logs;
                          } else {
                              myself.updateTreedata();
                          }
                      } else {
                          myself.$message.error("错误:" + response.msg);
                      }
                  })
                  .catch(e => {});
          } else {
              return false;
          }
      });
  },
  // 染色结果报告
  saveBactpreeval(myself, prgno, execflag, treeLable, releaseflag) {
      if (prgno == "BAC230") myself.bactPreEval.releaseflag = releaseflag;
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "savebactpreeval",
                  sampleid: myself.xtable3Row.sampleid,
                  refid: prgno == "BAC230" ? myself.bactPreEval.preevalid : myself.refid,
                  ...myself.bactPreEval,
                  execflag: execflag,
                  prgno: prgno,
                  inputmsg: myself.InputMsg,
              }
          })
          .then(response => {
              if (response.flag == 1) {
                  // this.$message.success("保存成功！");
                  if (response.needsend == 1) {
                      if (!myself.CurrentCheckUser.userno) {
                          myself.$rm_Login({
                              type: "请输入报告发布者工号和密码",
                              btn: {
                                  confirmBtnText: "确定",
                                  cancelBtnText: "取消"
                              }
                          }).then(res => {
                              myself.preevalVisible = false;
                              if (res.flag == "1") {
                                  if (prgno == "BAC230") {
                                      myself.updateCheckUser(2, res.userid, res.username)
                                  } else {
                                      myself.CheckUser = res.userid;
                                      myself.rechkusername = res.username;
                                      myself.CurrentCheckUser = { userno: myself.CheckUser, username: myself.rechkusername };
                                  }
                                  myself.alertType = 1;
                                  this.sendAlertReportCa(myself, prgno, res.userid);
                              } else { //登录失败
                                  myself.$emit("updateOpr", 1);
                              }
                          });
                      } else {
                          myself.preevalVisible = false;
                          myself.alertType = 1;
                          this.sendAlertReportCa(myself, prgno, myself.CurrentCheckUser.userno);
                      }
                  } else {
                      myself.preevalVisible = false;
                      if (prgno == "BAC224") {
                          myself.querySampleInfo(myself.xtable3Row);
                      } else if (prgno == "BAC230") { // 区分菌落观察里发的报告还是初鉴里发的报告
                          if (treeLable == "菌落观察") {
                              myself.$emit("updateOpr", 1);
                          } else if (treeLable == "初鉴") { // 单独更新初鉴树节点
                              myself.updatePreNode();
                          }
                      }
                  }
              } else if (response.flag == -1) {
                  // this.$message.error("错误：" + response);
                  this.ErrorListDeal(myself, response.msg, response.flag, 0);
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag, 0)
                      .then(() => {
                          // this.bactreportid = response.bactreportid;
                          // this.execCheckReport(type, '', '', response.smearid);
                          if (response.otherflag == 1) {
                              this.uncheckreportotheroper(myself, prgno, response.callback_reportid);
                          } else {
                              this.saveBactpreeval(myself, prgno, execflag, treeLable, 1);
                          }
                      })
                      .catch(() => {
                          // console.log("ErrorListDeal catch");
                      });
              }
          })
          .catch(e => {
              // this.$message.error("网络超时！")
          });
  },
  sendAlertReportCa(myself, prgno, rechkuser) { // 发布危急值 增加审核CA判断
      myself.rechkuser = rechkuser;
      if (myself.bactreportcheckusecaflag == "1") {
          this.checkCaLogin(myself, myself.CheckUser).then(cares => {
              if (cares.flag == "1") {
                  this.sendAlertReport(myself, prgno, rechkuser);
              } else {
                  myself.$alert("CA登录失败！" + cares.msg, "登陆失败", {
                      confirmButtonText: "确定",
                      type: "error"
                  });
              }
          });
      } else {
          this.sendAlertReport(myself, prgno, rechkuser);
      }
  },
  //发布染色结果报告
  sendAlertReport(myself, prgno, rechkuser, type) { // 增加CA判断
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "sendalertreport",
                  labgroupid: prgno == "BAC224" ? myself.searchParam.labgroupid : myself.labgroupid,
                  sampleid: myself.xtable3Row.sampleid,
                  preevalid: prgno == "BAC230" ? myself.bactPreEval.preevalid : myself.refid,
                  rechkuser: rechkuser,
                  prgno: prgno,
              }
          })
          .then(response => {
              // console.log(response.flag);
              // this.reportVisible = false;
              myself.reportid = response.reportid;
              myself.bactreportid = response.bactreportid;
              if (response.flag == 1) {
                  if (response.alertflag == 1) {
                      // 危急值弹窗
                      myself.awaitAlertFlag = true;
                      myself.alertType = 1;
                      myself.dialogDangerVisible = true;
                  } else {
                      if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                          this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                              myself.$pub.message(myself, "发布成功！", "success");
                          })
                          .catch(() => {
                              myself.$pub.message(myself, "发布成功！CA签名失败!", "success");
                          });
                      } else {
                          myself.$pub.message(myself, "发布成功！", "success");
                      }
                      // this.$pub.message(this, "发布成功！", "success");
                      if (prgno == "BAC224") {
                          myself.querySampleInfo(myself.xtable3Row);
                      } else if (prgno == "BAC230") {
                          if (myself.opernode == "watchoper") {
                              myself.$emit("updateOpr", 1); // 更新树结构
                          } else {
                              myself.$emit("updateTreedata");
                          }
                      }
                      // this.getCodeFlag = true;
                  }
              } else if (response.flag == -1) {
                  if (response.msg.errorMsg.length > 0) {
                      this.ErrorListDeal(myself, response.msg, response.flag, 0);
                  }
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag, 0)
                      .then(() => {
                          if (response.alertflag == 1) {
                              // 危急值弹窗
                              myself.awaitAlertFlag = true;
                              myself.alertType = 1;
                              myself.dialogDangerVisible = true;
                          } else {
                              // this.execDyeingCheckReport(type, "", "", "");
                              this.execDyeingCheckReport(myself, prgno, type, "", "");
                          }
                      })
                      .catch(() => {
                          // console.log("ErrorListDeal catch");
                      });
              }
          })
          .catch(e => {});
  },
  execDyeingCheckReport(myself, prgno, type, alertreportflag, alertinfo) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "execdyeingcheckreport",
                  reportid: myself.reportid,
                  checkuser: myself.CheckUser,
                  inputmsg: myself.InputMsg,
                  alertreportflag: alertreportflag,
                  alertinfo: alertinfo,
                  preevalid: myself.refid, //其他检验主记录ID: 发布阴性报告的回调时传入
                  sampleid: myself.xtable3Row.sampleid,
                  bactreportid: myself.bactreportid,
                  prgno: prgno,
              }
          })
          .then(response => {
              myself.dialogDangerVisible = false;
              if (response.flag == 1) {
                  // this.getCodeFlag = true;
                  if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                      this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                          myself.$pub.message(myself, "发布成功！", "success");
                      })
                      .catch(() => {
                          myself.$pub.message(myself, "发布成功！CA签名失败!", "success");
                      });
                  } else {
                      myself.$pub.message(myself, "发布成功！", "success");
                  }
                  if (prgno == "BAC224") {
                      myself.querySampleInfo(myself.xtable3Row);
                  } else if (prgno == "BAC230") {
                      //myself.$emit("updateTreedata");
                      myself.$emit("updateOpr",1)
                  }
                  // this.$pub.message(this, "发布成功！", "success");
                  myself.continueAlert();
                  // if (type == 1) {
                  //     this.querySampleInfo(this.xtable3Row);
                  // }
              } else {
                  var errorMsg = response.msg.errorMsg;
                  myself.$confirm(errorMsg[0].content ? errorMsg[0].content : "错误", errorMsg[0].title ? errorMsg[0].title : "提示", {
                      confirmButtonText: "确定",
                      // cancelButtonText: "取消",
                      focusCancelButton: false,
                      closeOnClickModal: false,
                      showCancelButton: false,
                      type: "warning"
                  })
                      .then(() => {
                          myself.continueAlert();
                      })
                      .catch(() => {
                          myself.continueAlert();
                      });
              }
          })
          .catch(e => {});
  },
  // 召回染色结果一级报告
  unCheckPrereport(myself, prgno, reportid, opernode) {
      let response = myself.$tool
      // this.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "uncheckprereport",
                  sampleid: myself.xtable3Row.sampleid,
                  // preevalid: this.selrow.preevalid,
                  reportid: reportid,
                  prgno: prgno,
                  preevalid: (prgno == "BAC230" && opernode != "watchoper") ? myself.changePreeval.preevalid : "",
              },
          });
          // .then((response) => {
          //     if (response.flag == 1) {
          //         this.$message({
          //             showClose: true,
          //             message: "解审成功！",
          //             type: 'success'
          //         });
          //         this.querySampleInfo(this.xtable3Row.sampleid);
          //     } else {
          //         this.ErrorListDeal(response.msg, response.flag).then(() => {
          //             this.execUncheckreport(response.reportid);
          //         });
          //     }
          // })
          // .catch((e) => {});
          return response;
  },
  execUncheckPrereport(myself, prgno, reportid, opernode) {
      return new Promise((s, f) => {
          let preevalid = 0;
          if (opernode == "watchoper") {
              preevalid = myself.bactPreEval.preevalid;
          } else if (prgno == "BAC227") {
              preevalid = myself.selrow.preevalid;
          } else {
              preevalid = myself.changePreeval.preevalid;
          }
          myself.$tool
              .request({
                  url: "BAC/BAC2/BAC227",
                  method: "post",
                  data: {
                      action: "execuncheckreport",
                      sampleid: myself.xtable3Row.sampleid,
                      preevalid: preevalid,
                      reportid: reportid,
                      inputmsg: myself.InputMsg,
                      prgno: prgno,
                  },
              })
              .then((response) => {
                  if (response.flag == 1) {
                      myself.$pub.message(myself, "召回成功！", "success");
                      if (prgno == "BAC227" || prgno == "BAC224") {
                          myself.querySampleInfo(myself.xtable3Row.sampleid);
                      } else if (prgno == "BAC230") {
                          // myself.$emit("updateTreedata");
                          // 只更新当前树节点下的数据状态
                          if (opernode != "watchoper") {
                              myself.$emit("updateTreedata");
                              // myself.$emit("savaDatastate", 2, response.newpreeval[0], myself.changePreeval.preevalid, "preeval", "初鉴", 1, "", 0, "初鉴", response.bactpreeval, response.preevalid, "", response.bactreport);
                          } else {
                              this.saveBactpreeval(myself, "BAC230", "", "菌落观察", myself.bactPreEval.releaseflag);
                          }
                      }
                      s();
                  } else if (response.flag == -1) {
                      myself.$alert(!response.msg.errorMsg[0].content ? "解审失败！" : response.msg.errorMsg[0].content).then(() => {
                          f();
                      });
                  }
              });
      });
  },
  // 发布染色结果二级报告
  checkPreMedCaReport(myself, prgno) { // 增加审核CA判断
      if (myself.bactreportcheckusecaflag == "1") {
          this.checkCaLogin(myself, myself.CheckUser).then(cares => {
              if (cares.flag == "1") {
                  this.checkPreMedReport(myself, prgno);
              } else {
                  myself.$alert("CA登录失败！" + cares.msg, "登陆失败", {
                      confirmButtonText: "确定",
                      type: "error"
                  });
              }
          });
      } else {
          this.checkPreMedReport(myself, prgno);
      }
  },
  checkPreMedReport(myself, prgno){ // 审核时审核所有未发布的结果
      console.log("checkPreMedReport-----CheckUser:" + myself.CheckUser, myself.childCheckUser)
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "checkpremedreport",
                  labgroupid: prgno == "BAC227" ? myself.searchParam.labgroupid : myself.labgroupid,
                  sampleid: myself.xtable3Row.sampleid,
                  // results: this.selrow(),
                  // meds: this.tableDataResultAll, // 直接从数据库里面取
                  checkuser: myself.CheckUser,
                  prgno: prgno,
              },
          })
          .then((response) => {
              if (response.flag == 1) {
                  if (response.alertflag == 1) {
                      myself.bactreportid = response.bactreportid;
                      myself.reportid = response.reportid;
                      myself.dialogDangerVisible = true;
                  } else {
                      if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                          this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                              myself.$pub.message(myself, "审核成功！", "success");
                          })
                          .catch(() => {
                              myself.$pub.message(myself, "审核成功！CA签名失败!", "success");
                          });
                      } else {
                          myself.$pub.message(myself, "审核成功！", "success");
                      }
                      // this.$message({
                      //     showClose: true,
                      //     message: "审核成功！",
                      //     type: 'success'
                      // });
                      // myself.querySampleInfo(myself.xtable3Row.sampleid);
                      if (prgno == "BAC227") {
                          myself.querySampleInfo(myself.xtable3Row.sampleid);
                      } else if (prgno == "BAC230") {
                          myself.$emit("updateTreedata");
                      }
                  }
              } else if (response.flag == -1) {
                  if (response.msg.errorMsg.length > 0) {
                      this.ErrorListDeal(myself, response.msg, response.flag, 0);
                  }
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag, 0)
                      .then(() => {
                          myself.bactreportid = response.bactreportid;
                          myself.reportid = response.reportid;
                          if (response.alertflag == 1) {
                              // 危急值弹窗
                              myself.dialogDangerVisible = true;
                          } else {
                              this.execCheckPreMedReport(myself, prgno);
                          }
                      })
                      .catch(() => {
                          // console.log("ErrorListDeal catch");
                      });
              }
          })
          .catch((e) => {});
  },
  execCheckPreMedReport(myself, prgno, alertreportflag, alertinfo) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "execcheckpremedreport",
                  reportid: myself.reportid,
                  checkuser: myself.CheckUser,
                  inputmsg: myself.InputMsg,
                  alertreportflag: alertreportflag,
                  alertinfo: alertinfo,
                  sampleid: myself.xtable3Row.sampleid,
                  bactreportid: myself.bactreportid,
                  prgno: prgno,
              },
          })
          .then((response) => {
              if (alertreportflag) { // 危急值上报
                  if (response.flag == 1) {
                      if (alertreportflag == 1) {
                          if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                              this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                                  myself.$pub.message(myself, "上报成功！", "success");
                              })
                              .catch(() => {
                                  myself.$pub.message(myself, "上报成功！CA签名失败!", "success");
                              });
                          } else {
                              myself.$pub.message(myself, "上报成功！", "success");
                          }
                          // this.$pub.message(this, "上报成功！", "success");
                      } else {
                          if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                              this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                                  myself.$pub.message(myself, "审核成功！", "success");
                              })
                              .catch(() => {
                                  myself.$pub.message(myself, "审核成功！CA签名失败!", "success");
                              });
                          } else {
                              myself.$pub.message(myself, "审核成功！", "success");
                          }
                          // this.$pub.message(this, "审核成功！", "success");
                      }
                      myself.dialogDangerVisible = false;
                      if (prgno == "BAC227") {
                          myself.querySampleInfo(myself.xtable3Row.sampleid);
                      } else if (prgno == "BAC230") {
                          myself.$emit("updateTreedata");
                      }
                  } else {
                      var errorMsg = response.msg.errorMsg;
                      myself.$confirm(errorMsg[0].content ? errorMsg[0].content : "错误", errorMsg[0].title ? errorMsg[0].title : "提示", {
                          confirmButtonText: "确定",
                          // cancelButtonText: "取消",
                          focusCancelButton: false,
                          closeOnClickModal: false,
                          showCancelButton: false,
                          type: "warning",
                      });
                  }
              } else { // 正常审核
                  if (response.flag == 1) {
                      if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                          this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                              myself.$pub.message(myself, "审核成功！", "success");
                          })
                          .catch(() => {
                              myself.$pub.message(myself, "审核成功！CA签名失败!", "success");
                          });
                      } else {
                          myself.$pub.message(myself, "审核成功！", "success");
                      }
                      if (prgno == "BAC227") {
                          myself.querySampleInfo(myself.xtable3Row.sampleid);
                      } else if (prgno == "BAC230") {
                          myself.$emit("updateTreedata");
                      }
                  } else {
                      var errorMsg = response.msg.errorMsg;
                      myself.$confirm(errorMsg[0].content ? errorMsg[0].content : "错误", errorMsg[0].title ? errorMsg[0].title : "提示", {
                          confirmButtonText: "确定",
                          // cancelButtonText: "取消",
                          focusCancelButton: false,
                          closeOnClickModal: false,
                          showCancelButton: false,
                          type: "warning",
                      });
                  }
              }
          })
          .catch((e) => {});
  },
  // 召回染色结果二级药敏报告
  unCheckMedreport(myself, prgno) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "uncheckmedreport",
                  sampleid: myself.xtable3Row.sampleid,
                  preevalid: prgno == "BAC227" ? myself.selrow.preevalid : myself.changePreeval.preevalid,
                  prgno: prgno,
              },
          })
          .then((response) => {
              if (response.flag == 1) {
                  myself.$pub.message(myself, "解审成功！", "success");
                  if (prgno == "BAC227") {
                      myself.querySampleInfo(myself.xtable3Row.sampleid);
                  } else if (prgno == "BAC230") {
                      myself.$emit("updateTreedata");
                  }
              } else {
                  myself.ErrorListDeal(myself, response.msg, response.flag).then(() => {
                      myself.execUncheckMedreport(response.reportid);
                  });
              }
          })
          .catch((e) => {});
  },
  execUncheckMedreport(myself, prgno, reportid) {
      return new Promise((s, f) => {
          myself.$tool
              .request({
                  url: "ucent/bactcomm",
                  method: "post",
                  data: {
                      action: "execuncheckmedreport",
                      sampleid: myself.xtable3Row.sampleid,
                      preevalid: prgno == "BAC227" ? myself.selrow.preevalid : myself.changePreeval.preevalid,
                      reportid: reportid,
                      inputmsg: myself.InputMsg,
                      prgno: prgno,
                  },
              })
              .then((response) => {
                  if (response.flag == 1) {
                      myself.$pub.message(myself, "解审成功！", "success");
                      if (prgno == "BAC227") {
                          myself.querySampleInfo(myself.xtable3Row.sampleid);
                      } else if (prgno == "BAC230") {
                          myself.$emit("updateTreedata");
                      }
                      s();
                  } else if (response.flag == -1) {
                      myself.$alert(!response.msg.errorMsg[0].content ? "解审失败！" : response.msg.errorMsg[0].content).then(() => {
                          f();
                      });
                  }
              });
      });
  },
  // 涂片 发送阴性结果
  sendnegativereport(myself, prgno) {
      if (!myself.CheckUser) {
          if (myself.rechkdefaultuseloginuserflag == "1") { // 使用当前登录人作为审核者
              myself.CheckUser = myself.$tool.getSession(myself.$tool.loginuserno);
              myself.rechkusername = myself.$tool.getSession(myself.$tool.loginusername);
              myself.CurrentCheckUser = { userno: myself.CheckUser, username: myself.rechkusername };
              if (myself.CheckUser) {
                  this.execSendnegativereport(myself, prgno).then(response => {
                      // if (flag == 1) {
                          if (prgno == "BAC220") {
                              myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode);
                          } else {
                              // myself.$emit("updateTreedata");
                              // 只更新当前树节点下的数据状态
                              // myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", "涂片、其他检验结果", 1, "", 0, "涂片、其他检验结果", response.bactsmear, response.smearid, "", response.bactreport);
                              myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", myself.bactresultrename, 1, "", 0, myself.bactresultrename, response.bactsmear, response.smearid, "", response.bactreport);
                          }
                      // }
                  });
              }
          } else {
              myself.logincheckuser().then(CheckUser => {
                  myself.CheckUser = CheckUser;
                  if (myself.CheckUser) {
                      if (myself.bactreportcheckusecaflag == "1") {
                          this.checkCaLogin(myself, myself.CheckUser).then(cares => {
                              if (cares.flag == "1") {
                                  this.execSendnegativereport(myself, prgno).then(response => {
                                      // if (flag == 1) {
                                          if (prgno == "BAC220") {
                                              myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode);
                                          } else {
                                              // myself.$emit("updateTreedata");
                                              // 只更新当前树节点下的数据状态
                                              // myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", "涂片、其他检验结果", 1, "", 0, "涂片、其他检验结果", response.bactsmear, response.smearid, "", response.bactreport);
                                              myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", myself.bactresultrename, 1, "", 0, myself.bactresultrename, response.bactsmear, response.smearid, "", response.bactreport);
                                          }
                                          // }
                                  });
                              } else {
                                  myself.$alert("CA登录失败！" + cares.msg, "登陆失败", {
                                      confirmButtonText: "确定",
                                      type: "error"
                                  });
                                  // return 0;
                              }
                          });
                      } else {
                          this.execSendnegativereport(myself, prgno).then(response => {
                              // if (flag == 1) {
                                  if (prgno == "BAC220") {
                                      myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode);
                                  } else {
                                      // myself.$emit("updateTreedata");
                                      // 只更新当前树节点下的数据状态
                                      // myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", "涂片、其他检验结果", 1, "", 0, "涂片、其他检验结果", response.bactsmear, response.smearid, "", response.bactreport);
                                      myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", myself.bactresultrename, 1, "", 0, myself.bactresultrename, response.bactsmear, response.smearid, "", response.bactreport);
                                  }
                              // }
                          });
                      }
                  } else {
                      // return 0;
                  }
              });
          }
      } else {
          this.execSendnegativereport(myself, prgno).then(response => {
              // if (flag == 1) {
                  if (prgno == "BAC220") {
                      myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode);
                  } else {
                      // myself.$emit("updateTreedata");
                      // 只更新当前树节点下的数据状态
                      // myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", "涂片、其他检验结果", 1, "", 0, "涂片、其他检验结果", response.bactsmear, response.smearid, "", response.bactreport);
                      myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", myself.bactresultrename, 1, "", 0, myself.bactresultrename, response.bactsmear, response.smearid, "", response.bactreport);
                  }
              // }
          });
      }
  },
  async execSendnegativereport(myself, prgno) {
      let response = await myself.$tool.request({
          url: "ucent/bactcomm",
          method: "post",
          data: {
              action: "sendnegativereport",
              smearid: prgno == "BAC220" ? myself.tabList[myself.nowTab].smearid : myself.changeSmear.smearid,
              sampleid: myself.xtable3Row.sampleid,
              labgroupid: prgno == "BAC220" ? myself.searchParam.labgroupid : myself.labgroupid,
              rechkuser: myself.CheckUser,
              prgno: prgno,
          },
      });
      if (response.flag == 1) {
          if (response.alertflag == 1) {
              myself.reportid = response.reportid;
              myself.bactreportid = response.bactreportid;
              myself.dangerType = 1;
              myself.dialogDangerVisible = true;
          } else {
              if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                  this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                      myself.$message.success("发布成功！");
                      // return 1;
                      return response;
                  })
                  .catch(() => {
                      myself.$message.success("发布成功！CA签名失败!");
                      // return 1;
                      return response;
                  });
              } else {
                  myself.$message.success("发布成功！");
                  // return 1;
                  return response;
              }
          }
      } else if (response.flag == -1) {
          await myself.$alert(!response.msg.errorMsg[0].content ? "发布失败" : response.msg.errorMsg[0].content);
          if (prgno == "BAC220") {
              myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode);
          }
          // return 0;
          return response;
      } else {
          this.ErrorListDeal(myself, response.msg, response.flag, 0).then(() => {
              if (response.alertflag == 1) { // 危急值弹窗
                  myself.reportid = response.reportid;
                  myself.bactreportid = response.bactreportid;
                  myself.dangerType = 1;
                  myself.dialogDangerVisible = true;
              } else {
                  this.execCheckSmearReport(myself, prgno, response.reportid, response.bactreportid, prgno == "BAC220" ? myself.tabList[myself.nowTab].smearid : myself.changeSmear.smearid)
                      .then(() => {
                          // return 1;
                          return response;
                      })
                      .catch((e) => {
                          // return 0;
                          return response;
                      });
              }
          })
          .catch(() => {
              // return 0;
              return response;
          });
      }
  },
  execCheckSmearReport(myself, prgno, reportid, bactreportid, smearid) {
      return new Promise((s, f) => {
          myself.$tool
              .request({
                  url: "ucent/bactcomm",
                  method: "post",
                  data: {
                      action: "execsendnegativereport",
                      reportid: reportid,
                      checkuser: myself.CheckUser,
                      inputmsg: myself.InputMsg,
                      smearid: smearid, //其他检验主记录ID: 发布阴性报告的回调时传入
                      sampleid: myself.xtable3Row.sampleid,
                      bactreportid: bactreportid,
                      prgno: prgno,
                  },
              })
              .then((response) => {
                  if (response.flag == 1) {
                      if (response.hasOwnProperty("checkca") && response.checkca == "1") {
                          this.ReportCheckCA(myself, response, myself.CheckUser).then(() => {
                              myself.$message.success("发布成功！");
                          })
                          .catch(() => {
                              myself.$message.success("发布成功！CA签名失败!");
                          });
                      } else {
                          myself.$message.success("发布成功！");
                      }
                      // this.$message.success("发布成功！");
                      // myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode);
                      if (prgno == "BAC220") {
                          myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode);
                      } else {
                          // myself.$emit("updateTreedata");
                          // 只更新当前树节点下的数据状态
                          // myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", "涂片、其他检验结果", 1, "", 0, "涂片、其他检验结果", response.bactsmear, response.smearid, "", response.bactreport);
                          myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", myself.bactresultrename, 1, "", 0, myself.bactresultrename, response.bactsmear, response.smearid, "", response.bactreport);
                      }
                      myself.dialogDangerVisible = false;
                      s();
                  } else {
                      myself.$alert(!response.msg.errorMsg[0].content ? "发布失败" : response.msg.errorMsg[0].content).then(() => {
                          f();
                      });
                  }
              })
              .catch((e) => {
                  f();
              });
      });
  },
  // 涂片 召回阴性报告
  async unCheckNegativereport(myself, prgno) {
      let ret = await myself.$tool.request({
          url: "ucent/bactcomm",
          method: "post",
          data: {
              action: "unchecknegativereport",
              sampleid: myself.xtable3Row.sampleid,
              smearid: prgno == "BAC220" ? myself.tabList[myself.nowTab].smearid : myself.changeSmear.smearid,
              userno: myself.$tool.getSession(myself.$tool.loginuserno),
              prgno: prgno,
          },
      });
      if (ret.flag == 1) {
          myself.$message.success("召回成功！");
          if (prgno == "BAC220") {
              myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode);
          } else {
              // myself.$emit("updateTreedata");
              // 只更新当前树节点下的数据状态
              // myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", "涂片、其他检验结果", 1, "", 0, "涂片、其他检验结果", response.bactsmear, response.smearid, "", response.bactreport);
              myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", myself.bactresultrename, 1, "", 0, myself.bactresultrename, response.bactsmear, response.smearid, "", response.bactreport);
          }
          return 1;
      } else if (ret.flag == -1) {
          await myself.$alert(!ret.msg.errorMsg[0].content ? "召回失败" : ret.msg.errorMsg[0].content);
          return 0;
      } else {
          this.ErrorListDeal(myself, ret.msg, ret.flag, 0)
              .then(() => {
                  if (ret.otherflag == 1) {
                      this.uncheckreportotheroper(myself, prgno, ret.reportid)
                          .then(() => {
                              return 0;
                          })
                          .catch((e) => {
                              return 0;
                          });
                  } else {
                      this.execunCheckSmearReport(myself, prgno, ret.reportid)
                          .then(() => {
                              return 1;
                          })
                          .catch((e) => {
                              return 0;
                          });
                  }
              })
              .catch(() => {
                  return 0;
              });
      }
  },
  execunCheckSmearReport(myself, prgno, reportid) {
      return new Promise((s, f) => {
          myself.$tool
              .request({
                  url: "ucent/bactcomm",
                  method: "post",
                  data: {
                      action: "execunchecksmearreport",
                      sampleid: myself.xtable3Row.sampleid,
                      smearid: prgno == "BAC220" ? myself.tabList[myself.nowTab].smearid : myself.changeSmear.smearid,
                      reportid: reportid,
                      inputmsg: myself.InputMsg,
                      prgno: prgno,
                  },
              })
              .then((response) => {
                  if (response.flag == 1) {
                      myself.$message.success("召回成功！");
                      if (prgno == "BAC220") {
                          myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode);
                      } else {
                          // myself.$emit("updateTreedata");
                          // 只更新当前树节点下的数据状态
                          // myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", "涂片、其他检验结果", 1, "", 0, "涂片、其他检验结果", response.bactsmear, response.smearid, "", response.bactreport);
                          myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", myself.bactresultrename, 1, "", 0, myself.bactresultrename, response.bactsmear, response.smearid, "", response.bactreport);
                      }
                      s();
                  } else if (response.flag == -1) {
                      myself.$alert(!response.msg.errorMsg[0].content ? "召回失败！" : response.msg.errorMsg[0].content).then(() => {
                          f();
                      });
                  }
              });
      });
  },

  // 解除审核过程中 其他操作 目前只有发送解除审核申请
  uncheckreportotheroper(myself, prgno, reportid) {
      return new Promise((s, f) => {
          myself.$tool
              .request({
                  url: "ucent/bactcomm",
                  method: "post",
                  data: {
                      action: "uncheckreportotheroper",
                      reportid: reportid,
                  },
              })
              .then((response) => {
                  if (prgno == "BAC220") {
                      if (response.flag == 1) {
                          myself.$message.success("发送解除审核申请成功！");
                          myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode);
                          if (myself.sampleuncheckflag == 1) {
                              myself.xtable3Row.rechk_dt = "";
                              myself.xtable3Row.rechk_user = "";
                          }
                          myself.sampleuncheckflag = "";
                          s();
                      } else if (response.flag == -1) {
                          myself.$alert(!response.msg.errorMsg[0].content ? "发送解除审核申请失败！" : response.msg.errorMsg[0].content).then(() => {
                              f();
                          });
                      }
                  } else if (prgno == "BAC223") {
                      if (response.flag == 1) {
                          myself.$pub.message(myself, "发送解除审核申请成功！", "success");
                          myself.reportVisible = false;
                          return false;
                      }
                      if (response.flag == -1) {
                          // this.$message.error("错误：" + response);
                          this.ErrorListDeal(myself, response.msg, response.flag, 0);
                          return false;
                      }
                  } else {
                      if (response.flag == 1) {
                          myself.$pub.message(myself, "发送解除审核申请成功！", "success");
                      }
                      if (response.flag == -1) {
                          // this.$message.error("错误：" + response);
                          this.ErrorListDeal(this, response.msg, response.flag, 0);
                      }
                  }
              });
      });
  },
  // 涂片结果单选、多选
  changeSmearresult(myself) {
      if (myself.popitemvalmutli != "1") {
          var row = myself.$refs.xTableResultAll.getCurrentRow();
          if (row) {
              myself.changeResult(row);
          } else {
              myself.$pub.message(myself, "未选中报告结果", "warning");
          }
      } else { // 多选拼接文字结果
          let updateRecords = myself.$refs.xTableResultAll.getSelectRecords();
          let textvalue = "";
          if (updateRecords.length > 0) {
              updateRecords.forEach(element => {
                  textvalue += element.textvalue + myself.popitemvalmutliaddstr;
              });
              if (textvalue) textvalue = textvalue.substring(0, textvalue.length - myself.popitemvalmutliaddstr.length);
              var uprow = myself.$refs.xTable.getCurrentRow();
              uprow[myself.resultColumn] = textvalue;
              myself.dialogResultVisible = false;
              this.calcRef(myself, uprow);
          } else {
              myself.$pub.message(myself, "未选中报告结果", "warning");
          }
      }
  },

  // 涂片报告预览、打印
  printSmearReport(myself, prgno, printorview) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "printsmearreport",
                  smearid: prgno == "BAC220" ? myself.tabList[myself.nowTab].smearid : myself.changeSmear.smearid,
                  printorview: printorview,
              },
          })
          .then((response) => {
              if (response.flag == 1) {
                  this.PrintFunc(myself, printorview, response.reportid);
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag);
              }
          });
  },
  printSampleReport(myself, printorview) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "printsamplereport",
                  sampleid: myself.xtable3Row.sampleid,
                  printorview: printorview,
              },
          })
          .then((response) => {
              if (response.flag == 1) {
                  this.PrintFunc(myself, printorview, response.reportid);
              } else {
                  myself.$message({
                      showClose: true,
                      message: "错误:" + response.msg,
                      type: 'error'
                  });
                  // this.ErrorListDeal(response.Item2, response.Item1);
              }
          });
  },
  // PrintSmearFunc(myself, type, reportid) {
  //     const loading = myself.$loading({
  //         lock: true,
  //         text: "打印中",
  //         spinner: "el-icon-loading",
  //         background: "rgba(0, 0, 0, 0.7)",
  //     });
  //     myself.$pub.printreport(myself, reportid, type, "", "1", "1");
  //     loading.close();
  // },
  // 删除阴性、阳性结果
  preDelresult(myself, prgno, row) {
      if (row.alertreportid) {
          myself.$confirm('已发布的危急值，确定删除已发布的危急值并召回发布的危急值报告?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
          }).then(() => {
              if (prgno == "BAC230") {
                  this.delResult(myself, prgno, row, "");
              } else {
                  myself.$confirm("确定删除当前结果？", "提示", {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      focusCancelButton: false,
                      type: "warning",
                  }).then(() => {
                      this.delResult(myself, prgno, row, "");
                  })
                  .catch(() => {});
              }
          }).catch(() => {});
      } else {
          if (prgno == "BAC230") {
              this.delResult(myself, prgno, row, "");
          } else {
              myself.$confirm("确定删除当前结果？", "提示", {
                  confirmButtonText: "确定",
                  cancelButtonText: "取消",
                  focusCancelButton: false,
                  type: "warning",
              }).then(() => {
                  this.delResult(myself, prgno, row, "");
              })
              .catch(() => {});
          }
      }
  },
  delResult(myself, prgno, row, execflag) {
      myself.$tool
          .request({
              url: "ucent/bactcomm",
              method: "post",
              data: {
                  action: "delresult",
                  sampleid: myself.xtable3Row.sampleid,
                  evalid: row.evalid,
                  smearid: row.smearid,
                  preevalid: row.preevalid,
                  rpt_itemcode: row.rpt_itemcode,
                  execflag: execflag,
                  prgno: prgno,
                  labgroupid: myself.searchParam.labgroupid,
              },
          })
          .then((response) => {
              if (response.flag == 1) {
                  myself.$pub.message(myself, "删除成功！", "success");
                  myself.xtable3Row.samplequality = response.samplequality;
                  if (prgno == "BAC232") {
                      if (myself.mededitpopflag == "1") {
                          var alld = myself.$refs.bactTable.tableData;
                          var rowindex = alld.indexOf(row);
                          myself.$refs.bactTable.remove(row);
                          let havedata = myself.$refs.bactTable.tableData;
                          if (havedata.length > 0) {
                              if (rowindex >= havedata.length) rowindex = havedata.length - 1;
                              let selectrow = havedata[rowindex];
                              myself.$refs.bactTable.setCurrentRow(selectrow);
                              myself.selrow = selectrow;
                              myself.queryMedInfo(myself.selrow.evalid, myself.selrow.rpt_itemcode);
                          } else {
                              myself.$refs.bactTable.setCurrentRow(null);
                              myself.selrow = {};
                              myself.medList = [];
                          }
                      } else {
                          myself.querySampleInfo(myself.xtable3Row.sampleid);
                      }
                  } else {
                      myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.purposeno);
                  }
              } else if (response.flag == -1) {
                  // this.$message.error("错误：" + response);
                  this.ErrorListDeal(myself, response.msg, response.flag, 0);
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag, 0)
                      .then(() => {
                          if (response.otherflag == 1) {
                              this.uncheckreportotheroper(myself, prgno, response.callback_reportid);
                          } else {
                              this.delResult(myself, prgno, row, 1);
                          }
                      })
                      .catch(() => {
                          // console.log("ErrorListDeal catch");
                      });
              }
          })
          .catch((e) => {});
  },
  getProcesslist(myself, prgno) {
      // let jsonData = [
      //     {"title":"样本号","property":"sampleno"},
      //     {"title":"姓名","property":"pat_name"},
      //     {"title":"性别","property":"pat_sexname"},
      //     {"title":"病历号","property":"inp_id"},
      //     {"title":"申请科室","property":"req_deptname"},
      //     {"title":"病区","property":"req_wardname"},
      //     {"title":"床号","property":"req_bedno"},
      //     {"title":"申请医生","property":"req_docnoname"},
      //     {"title":"申请时间","property":"req_dt"},
      //     {"title":"临床诊断","property":"pat_diag"},
      //     {"title":"条码号","property":"barcode"},
      //     {"title":"样本类型","property":"specimen_name"},
      //     {"title":"收样时间","property":"recieve_dt"},
      //     {"title":"培养条件","property":"conidtions"},
      //     {"title":"培养周期","property":"culturehour"},
      //     {"title":"培养基组","property":"mediumgroupname"},
      //     {"title":"接种时间","property":"description"},
      //     {"title":"接种人","property":"description"},
      //     {"title":"观察","property":"description"},
      //     {"title":"其他结果","property":"description"},
      //     {"title":"操作时间","property":"inputtime"},
      //     {"title":"操作员","property":"inputuser"},
      //     {"title":"鉴定结果","property":"evalresult"},
      //     {"title":"鉴定时间","property":"evaltime"},
      //     {"title":"鉴定人","property":"evalusername"},
      //     {"title":"药敏","property":"description"},
      //     {"title":"检验者","property":"report_username"},
      //     {"title":"审核者","property":"rechk_username"},
      //     {"title":"审核时间","property":"rechk_dt"},
      // ];
      // let str = JSON.stringify(jsonData);
      // str += "\r";
      // var StatData = [];
      // str += JSON.stringify(StatData);
      // let sql = btoa(encodeURIComponent(str));
      // this.$tool
      //     .request({
      //         url: "BAC/BAC2/BAC232",
      //         method: "post",
      //         data: {
      //             action: "getprocesslist",
      //             styleid: this.styleid,
      //             tablename: "流程单",
      //             jsonData: jsonData, // 列名加data
      //             sampleid: this.xtable3Row.sampleid,
      //         },
      //     })
      //     .then((response) => {
      //         this.processstr = response.processstr;
      //     })
      //     .catch((e) => {
      //         // this.$message.error("网络超时！")
      //     });
      myself.$tool
          .request({
              url: "ucent/print",
              method: "post",
              data: {
                  action: "germsheetprintview",
                  sampleid: myself.xtable3Row.sampleid,
                  styleid: prgno == "BAC230" ? myself.reportid : myself.samplestyleid,
              }
          })
          .then(res => {
              if (res.flag == "0") {
                  myself.$alert(res.msg);
              } else {
                  //流程单预览页面允许用户直接打印，删除#toolbar=0，显示浏览器自带的pdf打印按钮
                  myself.processstr = '<embed id="embed-report" width="100%" height="' + document.getElementById("process").clientHeight + 'px"  name="plugin" src="' + res.pdfurl + '" type="application/pdf" >';
                  // this.$alert(hml, "流程单预览", {
                  //     dangerouslyUseHTMLString: true,
                  //     customClass: "rptprintview"
                  // });
              }
          })
          .catch(e => {
              myself.$alert("预览报告出错！", "错误", {
                  confirmButtonText: "确定"
              });
          });
  },
  getTableUpdateFlag(updateRecords) {
      let updateflag = false;
      if (updateRecords.insertRecords.length > 0 || updateRecords.removeRecords.length > 0 || updateRecords.updateRecords.length > 0) updateflag = true;
      return updateflag;
  },
  // 签名、解除签名
  signName(myself, type, row, prgno) { // type 1: 签名，2: 解除签名
      if (myself.xtable3Row.rechk_dt) return false;
      let data = {
          action: "signname",
          sampleid: myself.xtable3Row.sampleid,
          prgno: prgno,
          signnameflag: type,
          sign_user: myself.reportuser,
      }
      if (row) data = {
          action: "signname",
          sampleid: myself.xtable3Row.sampleid,
          prgno: prgno,
          signnameflag: type,
          evalid: row.evalid,
          smearid: row.smearid,
          preevalid: row.preevalid,
          sign_user: myself.reportuser,
          bactwatchdetid: row.bactwatchdetid,
          bactseq: row.bactseq,
      }
      myself.$tool.request({
          url: "ucent/bactcomm",
          method: "post",
          data: {
              ...data,
          },
      })
      .then((response) => {
          if (response.flag == 1) {
              let msg = "签名成功！";
              if (type == 2) msg = "解除签名成功！";
              myself.$pub.message(myself, msg, "success");
              if (prgno == "BAC232") {
                  myself.querySampleInfo(myself.xtable3Row.sampleid);
              } else if (prgno == "BAC230") {
                  if (row.smearid > 0) {
                      // myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", "涂片、其他检验结果", 1, "", 0, "涂片、其他检验结果", response.bactsmear, response.smearid, "", response.bactreport);
                      myself.$emit("savaDatastate", 2, response.nowsmear, myself.changeSmear.smearid, "smear", myself.bactresultrename, 1, "", 0, myself.bactresultrename, response.bactsmear, response.smearid, "", response.bactreport);
                  } else if (row.evalid > 0) {
                      myself.changeEval.sign_dt = response.noweval[0].signnamedt;
                      myself.$emit("savaDatastate", 2, response.noweval[0], myself.changeEval.evalid, "eval", "鉴定、药敏", 1, "", 0, "鉴定、药敏", response.bacteval, response.evalid, "", response.bactreport);
                  } else if (row.preevalid > 0) {
                      myself.changePreeval.sign_dt = response.nowpreeval.sign_dt;
                      myself.$emit("savaDatastate", 2, response.nowpreeval, myself.changePreeval.preevalid, "preeval", "初鉴", 1, "", 0, "初鉴", response.bactpreeval, response.preevalid, "", response.bactreport);
                  } else if (row.bactwatchdetid > 0) {
                      myself.changeWatch.sign_dt = response.nowwatch[0].sign_dt;
                      myself.$emit("savaDatastate", 2, response.nowwatch[0], myself.changeWatch.bactwatchdetid, "watch", "菌落观察", 1, "", 0, "菌落观察", response.bactwatch, response.bactwatchdetid, "", response.bactreport);
                  } else {
                      myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.purposeno);
                  }
              } else if (prgno == "BAC220") {
                  myself.querySampleInfo(myself.xtable3Row.sampleid, myself.xtable3Row.barcode, 1);
                  // 同时需要手动更新样本信息数据的签名
                  myself.xtable3Row.sign_dt = response.sampledt[0].sign_dt;
                  myself.xtable3Row.sign_username = response.sampledt[0].sign_username;
              }
          } else {
              myself.$pub.message(myself, response.msg, "error");
          }
      })
      .catch(() => {
          // console.log("ErrorListDeal catch");
      });
  },
  // 样本审核、签名、退回 禁止修改状态判断
  getSampleeditflag(xtable3Row) {
      let editflag = true;
      if (xtable3Row.rechk_dt || xtable3Row.sign_dt || xtable3Row.req_stat == '8') editflag = false;
      return editflag;
  },
  //检验目的多选
  popMultipleChk(myself) {
      let temp = JSON.parse(JSON.stringify(myself.purposeList));
      myself.option1 = [];
      myself.option2 = [];
      console.log(myself.searchParam.purposeno)
      if (myself.searchParam.purposeno) {
          let k = myself.searchParam.purposeno.split(",");
          k.forEach(item => {
              let ndata = temp.find(m => m.data == item);
              if (ndata != undefined && ndata != null) {
                  myself.option2.push(ndata);
              }
          });
          temp.forEach(item => {
              if (k.indexOf(item.data + "") < 0) {
                  myself.option1.push(item);
              }
          });
      } else {
          myself.option1 = temp;
      }
      myself.dialogMultipleVisible = true;
  },
  // 接收登记
  acceptInfo(myself, prgno, barcode) {
      // e.target.addAttrbutes
      var arr = {};
      if (prgno == "BAC210") {
          myself.mediumList = [];
          myself.sampleInfoList = [];
          myself.$refs.xTable.clearCurrentRow();
          arr = myself.sampleList.find((item) => item.barcode == barcode.trim());
      } else {
          arr = myself.fsampleList.find((item) => item.barcode == barcode.trim());
      }
      if (arr) {
          // this.barcode = this.barcode + " 已找到对应条码号";
          // 去掉重复接收功能 应该没有哪种场景需要重复登记
          // if (arr.reacceptflag == 1) { // 判断是否允许重复接收
          //     this.$confirm("此条码号已经接收，接收日期：" + arr.input_dt + "， 标本号：" + arr.sampleno + "，是否重复接收？", "提示", {
          //         confirmButtonText: "确定",
          //         cancelButtonText: "取消",
          //         type: "warning",
          //     }).then(() => {
          //         if (this.beforeAcceptflag == "1") { // 执行接收前判断是否需要确认
          //             this.getBarcodeInfo("1");
          //         } else {
          //             this.inputBarcode("1");
          //         }
          //     });
          // } else {
              if (myself.reacceptremind == "1") {
                  myself.$confirm("此条码号已经接收，接收日期：" + arr.input_dt + "， 标本号：" + arr.sampleno, "提示", {
                      showCancelButton: false,
                      confirmButtonText: "确定",
                      type: "warning",
                  }).then(() => {});
              } else if (myself.reacceptremind == "2") {
                  myself.$pub.message(myself, "此条码号已经接收，接收日期：" + arr.input_dt + "， 标本号：" + arr.sampleno, "warning");
              }
              document.getElementById("inputbarcode").removeAttribute("disabled");
              if (prgno == "BAC210") {
                  myself.selrow = arr;
                  myself.$refs.xTable.setCurrentRow(arr);
                  myself.$refs.xTable.scrollToRow(arr);
                  myself.querySampleInfo(myself.selrow.sampleid, myself.selrow.barcode);
              } else {

              }
          // }
      } else {
          // document.getElementById("inputbarcode").setAttribute("disabled", "");
          this.sameReqorspectip(myself, prgno);
      }
      if (prgno != "BAC230") {
          myself.$nextTick(() => {
              myself.getCode();
          });
      }
  },
  sameReqorspectip(myself, prgno) {
      myself.$tool
          .request({
              url: "BAC/BAC2/BAC210",
              method: "post",
              data: {
                  action: "samereqorspectip",
                  labgroupid: myself.searchParam.labgroupid,
                  barcode: myself.$refs.inputbarcode.value,
              },
          })
          .then((res)=>{
              var tipcontent = "";
              if (res.isexistsamereq == 1) {
                  tipcontent = "此条码病人同一天已录入相同申请项目【"+res.samereq_itemname+"】的数据，是否继续";
              }
              if (res.isexistsamespec == 1) {
                  tipcontent = "此条码病人同一天已录入相同标本类型【"+res.samespecimen_name+"】的数据，是否继续";
              }
              if (res.isexistsamereq == 1 && res.isexistsamespec == 1){
                  tipcontent = "此条码病人同一天已录入相同申请项目【"+res.samereq_itemname+"】和相同标本类型【"+res.samespecimen_name+"】的数据，是否继续";
              }
              if (tipcontent != "") {
                  myself.$confirm(tipcontent, "提示", {
                      confirmButtonText: "确定",
                      cancelButtonText: "取消",
                      type: "warning",
                  }).then(() => {
                      if (myself.beforeAcceptflag == "1") { // 执行接收前判断是否需要确认
                          this.getBarcodeInfo(myself, prgno, "0");
                      } else {
                          this.inputBarcode(myself, prgno, "0");
                      }
                  });
              }else{
                  if (myself.beforeAcceptflag == "1") { // 执行接收前判断是否需要确认
                      this.getBarcodeInfo(myself, prgno, "0");
                  } else {
                      this.inputBarcode(myself, prgno, "0");
                  }
              }
          })
          .catch((e) => {
              console.log(e);
          });
  },
  inputBarcode(myself, prgno, reaccept) {
      if (prgno == "BAC210") {
          if(myself.banenter){
             //this.barcode = this.$refs.inputbarcode.value + " 接收中";
             //this.$pub.message(this, "提示：条码号【"+this.$refs.inputbarcode.value.trim()+"】接收中，请稍后", "warning");
             return false;
         }
         myself.banenter=true;
      }
      myself.$tool
          .request({
              url: "BAC/BAC2/BAC210",
              method: "post",
              data: {
                  action: "inputbarcode",
                  barcode: myself.$refs.inputbarcode.value.trim(),
                  ...myself.searchParam,
                  //reaccept: reaccept ? reaccept : "0", // 重复接收
              },
          })
          .then((response) => {
              // Item1: flag, Item2: msg, Item3: row, Item4: prtbottlenos, Item5: mediumlst
              if (response.flag == 1) {
                  if (response.row.data.length > 0) {
                      var notprintflagdt = response.notprintflagdt;
                      var newRow = response.row.data;
                      myself.barcode = myself.$refs.inputbarcode.value + " " + response.msg.showMsg[0].content;
                      // newRow.addState = 1;
                      // console.log(this.sampleList);
                      // this.sampleList.unshift(newRow);
                      if (prgno == "BAC210") {
                          var allData = newRow.concat(myself.sampleList);
                          myself.sampleList = allData;
                          myself.$refs.xTable.loadData(myself.sampleList).then(() => {
                              myself.selrow = newRow[newRow.length - 1];
                              myself.$refs.xTable.setCurrentRow(myself.selrow);
                              myself.$refs.xTable.scrollToRow(myself.selrow);
                              myself.querySampleInfo(myself.selrow.sampleid, myself.selrow.barcode);
                              myself.getCode();
                          });
                      } else {
                          // this.xtable3Row = newRow[0];
                          // this.sampleid = this.xtable3Row.sampleid;
                          var allData = myself.sampleList.concat(newRow);
                          myself.sampleList = allData;
                          myself.fsampleList = myself.fsampleList.concat(newRow);
                          myself.$refs.rightTable.getNowrowdata(newRow[0]);
                      }
                      this.printSmearbarcode(myself, newRow);
                      this.dealCode(myself, prgno, response.prtbottlenos, response.mediumlst, true);
                      myself.$nextTick(() => {
                          this.printproecss(myself, newRow,notprintflagdt);//打印流程单
                      });
                  } else {
                      if (prgno == "BAC210") {
                          myself.selrow = {};
                      }
                  }
              } else if (response.flag == -1) {
                  // if (response.reacceptflag == 1) { // 重复接收提示
                  //     BacCommon.ErrorListDeal(this, response.msg, -2, 0)
                  //         .then(() => {
                  //             this.inputBarcode("1");
                  //             this.getCode();
                  //         })
                  //         .catch(() => {
                  //             // console.log("ErrorListDeal catch");
                  //         });
                  // } else {
                      if (prgno == "BAC210") {
                          myself.selrow = {};
                      }
                      if (response.msg.errorMsg.length > 0) {
                          this.ErrorListDeal(myself, response.msg, response.flag, 0);

                      }
                  // }
              } else {
                  this.ErrorListDeal(myself, response.msg, response.flag, 0)
                      .then(() => {
                          this.saveBarcode(myself,prgno);
                          //this.getCode();
                      })
                      .catch(() => {
                          // console.log("ErrorListDeal catch");
                      });
              }
              if (prgno != "BAC210") {
                  document.getElementById("inputbarcode").removeAttribute("disabled", "");
              } else {
                  myself.getCode();
                  myself.banenter=false;
              }
          })
          .catch((e) => {
              if (prgno != "BAC210") {
                  document.getElementById("inputbarcode").removeAttribute("disabled", "");
              } else {
                  myself.banenter=false;
              }
              myself.getCode();
              console.log(e);
          });
  },
  saveBarcode(myself,prgno) {
      myself.$tool
          .request({
              url: "BAC/BAC2/BAC210",
              method: "post",
              data: {
                  action: "savebarcode",
                  barcode: myself.$refs.inputbarcode.value.trim(),
                  ...myself.searchParam,
              },
          })
          .then((response) => {
              console.log(response)
              if (response.flag == 1) {
                  if (response.row.data.length > 0) {
                      var newRow = response.row.data;
                      var notprintflagdt = response.notprintflagdt;
                      if(prgno == "BAC210"){
                          var allData = newRow.concat(myself.sampleList);
                          myself.sampleList = allData;
                          myself.$refs.xTable.loadData(myself.sampleList).then(() => {
                              myself.selrow = newRow[newRow.length - 1];
                              myself.$refs.xTable.setCurrentRow(myself.selrow);
                              myself.$refs.xTable.scrollToRow(myself.selrow);
                              myself.querySampleInfo(myself.selrow.sampleid, myself.selrow.barcode);
                              myself.getCode();
                          });
                      }else{
                          var allData = myself.sampleList.concat(newRow);
                          myself.sampleList = allData;
                          myself.fsampleList = myself.fsampleList.concat(newRow);
                          myself.$refs.rightTable.getNowrowdata(newRow[0]);
                      }
                      this.printSmearbarcode(myself,newRow); // 打印涂片标签
                      this.dealCode(myself, prgno, response.prtbottlenos, response.mediumlst,true);
                      myself.$nextTick(() => {
                          this.printproecss(myself, newRow,notprintflagdt);//打印流程单
                      });
                  } else {
                  }
              } else if (response.flag == -1) {
                  if (response.msg.errorMsg.length > 0) {
                      this.ErrorListDeal(this, response.msg, response.flag, 0);
                  }
              }
          })
          .catch((e) => {});
  },


  getBarcodeInfo(myself, prgno, type) { // type 为接收登记时的重复接收字段
      myself.$tool.request({
              url: "BAC/BAC2/BAC210",
              method: "post",
              data: {
                  action: "getbarcodeinfo",
                  barcode: myself.$refs.inputbarcode.value,
              },
          })
          .then((response) => {
              if (response.flag == 1) {
                  let beforeacceptInfo = response.data;
                  let msg = "当前核收条码号: " + beforeacceptInfo.barcode + " 姓名: " + beforeacceptInfo.pat_name + " 标本类型: " + beforeacceptInfo.specimen_name + " 申请项目: " + beforeacceptInfo.sample_items;
                  myself.$confirm(msg, '提示', {
                      confirmButtonText: '确定',
                      cancelButtonText: '取消',
                      type: 'warning'
                  }).then(() => {
                      this.inputBarcode(myself, prgno, type);
                  }).catch(() => { });
              } else {
                  myself.$pub.message(myself, "错误：" + response.msg, "warning");
              }
          });
  },
  printSmearbarcode(myself, rowList) { // 根据 autoprintsmearflag 判断是否需要打印涂片标签
      if (myself.autoprintsmearflag == 1) {
          rowList.forEach(element => {
              if (element.smearflag == 1 || element.smearflag == 2) myself.$pub.printMediumbarcode(myself, "", "1", myself.smearbarcodestyle, element.sampleid, 0, 0, 0, 7);
          });
      }
  },
  //根据autoprtProcess 判断是否需要打印流程单
  printproecss(myself, rowList,notprintflagdt){
      if(notprintflagdt && notprintflagdt.length>0){
          rowList.forEach(element => {
              var itemdt= notprintflagdt.filter((ele)=> ele.purposeno==element.purposeno && ele.specimen_code == element.specimen_code);
              if(itemdt.length>0){
                  var notprintflag= itemdt[0].notprintproecssflag;

                  if(notprintflag!="1"){
                      //myself.$alert("设置成功，会打印流程单！");
                      //console.log("打印流程单++++++++++++++++++++++++++++")
                      this.exePrtProcess(myself, element.sampleid);
                  }else{
                      //myself.$alert("设置成功，不打印流程单！");
                  }
              }
          });
      }else{
          if (myself.autoprtProcess == "1") {
              rowList.forEach(element => {
                  if (element.sampleid) this.exePrtProcess(myself, element.sampleid);
              });
          }
      }


  },
  // 撤销登记
  deleteSample(myself, prgno) {
      // flag 不等于1，-1，调 execdeletesample
      if (prgno == "BAC210") {
          if (!myself.selrow.sampleid) {
              myself.$pub.message(myself, "提示：请先选择要撤销的标本！", "warning");
              return false;
          }
          if (myself.selrow.rechk_dt) {
              myself.$pub.message(myself, "错误：当前标本已经审核！", "error");
              return false;
          }
      } else {
          if (!myself.xtable3Row.sampleid) {
              myself.$pub.message(myself, "提示：请先选择要撤销的标本！", "warning");
              return false;
          }
          if (myself.xtable3Row.rechk_dt) {
              myself.$pub.message(myself, "错误：当前标本已经审核！", "error");
              return false;
          }
      }
      myself.$tool.request({
          url: "BAC/BAC2/BAC210",
          method: "post",
          data: {
              action: "deletesample",
              sampleid: prgno == "BAC210" ? myself.selrow.sampleid : myself.xtable3Row.sampleid,
          },
      })
      .then((response) => {
          if (response.flag == 1) {
              // var mark = response.msg ? "," : "";
              // this.$confirm(response.msg + mark + "是否撤销登记?", "提示", {
                  let msg = response.msg + "是否撤销登记?"
                  let btntext="确定";
                  let sampleids = response.sampleids;
                  if(myself.delsampledelothersample=='1'){
                      msg = response.msg;
                      if(sampleids)
                          btntext = "撤销全部";
                  }
                  myself.$confirm(msg, "提示", {
                  confirmButtonText: btntext,
                  cancelButtonText: "取消",
                  focusCancelButton: true,
                  dangerouslyUseHTMLString: true,
                  type: "warning",
              }).then(() => {
                  if (myself.deletesamplemustreason) {
                      myself.$rm_Login({
                          type: "请输入工号和密码",
                          btn: {
                              confirmBtnText: "确定",
                              cancelBtnText: "取消",
                          },
                          deletesamplemustreason: myself.deletesamplemustreason,
                      }).then((res) => {
                          if (res.flag == "1") {
                              let rejectreason = res.rejectreason;
                              // this.$prompt('请输入否撤销登记原因', '提示', {
                              //     confirmButtonText: '确定',
                              //     cancelButtonText: '取消',
                              //     inputValidator:function(value) {
                              //         console.log(value)
                              //         if (!value) return false;
                              //     },
                              //     inputErrorMessage: '请输入撤销登记原因'
                              // }).then(({ value }) => {
                              //     this.execDeleteSample(res.userid, value);
                              // }).catch(() => { });
                              myself.execDeleteSample(res.userid, rejectreason,sampleids);
                          } else {
                              //登录失败
                          }
                      })
                      .catch((e) => {});
                  }
                  else{
                      myself.execDeleteSample("","",sampleids);
                  }
                      //
              })
              .catch(() => {});
          } else {
              myself.$pub.message(myself, "错误：" + response.msg, "error");
          }
      })
      .catch((e) => {});
      myself.getCode();
  },
  // 标本退回
  getRejectiReason(myself) {
      myself.$tool.request({
          url: "ucent/ddl",
          method: "post",
          data: {
              action: "RejectiReason",
          },
      })
      .then((res) => {
          myself.rejectiReasonList = res.RejectiReasonOption;
      })
      .catch((e) => {});
  },
  rejectSample(myself, prgno, sampleid, barcode) {
      myself.delsample = "0";
      myself.$tool.request({
          url: "BAC/BAC2/BAC210",
          method: "post",
          data: {
              action: "rejectbarcode",
              sampleid: sampleid,
              barcode: barcode,
          },
      })
      .then((response) => {
          // Item1: flag, Item2: msg, Item3: row, Item4: prtbottlenos, Item5: mediumlst
          if (response.flag != -1) {
              myself.rejectInfo = response.msg;
              myself.$confirm("是否同时删除样本信息？", '提示', {
                  confirmButtonText: '是',
                  cancelButtonText: '否',
                  type: 'warning'
              }).then(() => {
                  myself.delsample = "1";
                  myself.rejectDialogVisible = true;
              }).catch(() => {
                  myself.rejectDialogVisible = true;
              });
          } else {
              myself.$pub.message(myself, "错误：" + response.msg, "error");
          }
      })
      .catch((e) => {});
  },
  saveReject(myself, prgno, type) {
      var nowRow = myself.$refs.xTable6.getCurrentRow();
      if (nowRow) {
          console.log("nowRow",nowRow)
          if (type == 1) {
              if (myself.rejectInfo) {
                  return false;
              } else {
                  myself.saverejectbarcode(nowRow);
                  myself.getCode();
              }
          } else if (type == 2) {
              myself.saverejectbarcode(nowRow);
              myself.getCode();
          }
      } else {
          myself.$pub.message(myself, "错误：请先选择退回原因！", "error");
      }
  },
  // saverejectbarcode(myself, prgno, nowRow) {
  //     myself.$tool
  //         .request({
  //             url: "BAC/BAC2/BAC210",
  //             method: "post",
  //             data: {
  //                 action: "saverejectbarcode",
  //                 sampleid: prgno == "BAC210" ? myself.selrow.sampleid : myself.xtable3Row.sampleid,
  //                 barcode: prgno == "BAC210" ? myself.selrow.barcode : myself.xtable3Row.barcode,
  //                 reason: nowRow.label,
  //                 sampleno: prgno == "BAC210" ? myself.selrow.sampleno : myself.xtable3Row.sampleno,
  //                 sampledate: prgno == "BAC210" ? myself.searchParam.sampledate : myself.xtable3Row.sampledate,
  //                 delsample: myself.delsample,
  //             },
  //         })
  //         .then((response) => {
  //             if (response.flag == 1) { // 退回成功删除数据
  //                 if (prgno == "BAC210") {
  //                     var havedata = myself.$refs.xTable.getTableData().fullData;
  //                     var rowindex = havedata.indexOf(myself.selrow);
  //                     if (havedata.length > 0) {
  //                         myself.$refs.xTable.remove(myself.selrow);
  //                         havedata = myself.$refs.xTable.getTableData().fullData;
  //                         if (rowindex >= havedata.length) rowindex = havedata.length - 1;
  //                         if (myself.$refs.xTable.getTableData().fullData.length > 0) {
  //                             let selectrow = myself.$refs.xTable.getTableData().fullData[rowindex];
  //                             myself.$refs.xTable.setCurrentRow(selectrow);
  //                             myself.selrow = selectrow;
  //                             myself.querySampleInfo(myself.selrow.sampleid, myself.selrow.barcode);
  //                         } else {
  //                             myself.sampleInfoList = [];
  //                             myself.mediumList = [];
  //                             myself.selrow = {};
  //                         }
  //                     }
  //                     myself.sampleList = myself.$refs.xTable.getTableData().fullData;
  //                 } else {

  //                 }
  //                 myself.rejectInfo = "";
  //                 myself.rejectDialogVisible = false;
  //                 myself.$pub.message(myself, "退回成功！", "success");
  //             } else {
  //                 myself.$pub.message(myself, "错误：" + response.msg, "error");
  //             }
  //         })
  //         .catch((e) => {
  //             console.log("e",e)
  //         });
  // },
  cancelReject() {
      myself.rejectDialogVisible = false;
      myself.getCode();
  },
  getHistoryCondt(myself, element, refresultby) {
      // var compareStr = "";
      let sameflag = false;
      if (refresultby.length > 0) {
          let refflag = true;
          refresultby.forEach(ref => {
              // compareStr += `element.${element} == this.xtable3Row.${element} && `;
              if (element[ref] != myself.xtable3Row[ref]) refflag = false;
          });
          // compareStr = compareStr.substring(0, compareStr.length - 4);
          sameflag = refflag;
      } else {
          // compareStr = "element.pat_name == this.xtable3Row.pat_name && element.pat_no == this.xtable3Row.pat_no"; // 病历号 姓名
          if (element.pat_name == myself.xtable3Row.pat_name && element.pat_no == myself.xtable3Row.pat_no) sameflag = true;
      }
      return sameflag;
  },
  labgroupidTip(myself, labgroupid) {
      let labgroup = myself.glist.find((item)=> item.labgroupid == labgroupid);
      if (labgroup) {
          myself.$alert(`<div style='font-size: 16px; font-weight: bold; color: black;'>此样本属于【<span style='color: red;'>${labgroup.labgroupname}</span>】工作组，与当前页面显示的工作组不一致！</div>`, "提示", {
              type: "warning",
              dangerouslyUseHTMLString: true,
              callback: (action) => {
                  myself.getCode();
              },
          });
      }
  },
  getUpdateflag(myself, res, row) { // 增加修改标志判断
      let changeflag = false;
      let medresult = row.medresult;
      let result_flag = row.result_flag;
      let ranges = row.ranges;
      let medgroup = row.medgroup;
      let guidelines = row.guidelines;
      let nrflag = row.nrflag;
      let isimportant = row.isimportant;
      let medremarks = row.medremarks;
      let medmethod = row.medmethod;
      console.log(1, row.updateflag)  // 2303021001
      if ((res.resultstr && res.resultstr != medresult) || (res.resultflag && res.resultflag != result_flag) || (res.result6 && res.result6 != ranges) ||
          res.medgroup != medgroup || res.guidelines != guidelines || ((res.isBactNR ? "1" : "0") != nrflag)
          || res.isimportant != isimportant || res.medremarks != medremarks || medmethod != myself.$pub.formatmethod(res.method)) {
              console.log(2, row.updateflag)
          if (row.updateflag != 1) changeflag = true;
      }
      return changeflag;
  },
}
